When a platform function call is made in Smalltalk, all Smalltalk processes block until that call completes. Asynchronous callout is an extension to the standard platform function call protocol that allows developers to make a platform function call in a separate thread. By making the call in a separate thread, it ensures that only those processes waiting on the result of the platform function call block.
For example, if a socket receive call that blocks is made in Smalltalk, no Smalltalk processes run until the receive call completes. By using asynchronous callout, only those processes waiting on the return value of the receive operation block.
These are the ways a Smalltalk process makes asynchronous calls:
The syntax for using asynchronous calls is similar to normal platform function calls. The system sets up the OS resources required to make the call, executes the call, and recovers the resources automatically.
With resource futures calls, the system manages the OS resources. The system sets up the OS resources required to make the call, executes the call, and recovers the resources automatically. Resource future calls can be used for single asynchronous calls only.
Static futures calls require the developers to manage resources themselves. The advantage of a static future call is that it can be used to make more than one platform function call in the same thread. The developer must explicitly allocate the resources for the future and return them when the future is no longer required.