Pools
- Contents
- Compiling
- Running
- Under the Hood
- Notes
This sample demonstrates use of the
Compiling
To compile the example:
- Launch EiffelStudio.
- Select Use existing Ace (control file) and click OK
- Browse to $ISE_EIFFEL\examples\dotnet\threading\pools\
- Choose the Ace file for the version of the .net framework you are running
- Choose the directory where the project will be compiled, by default the same directory containing the Ace file.
- Click OK.
Running
After you launch the sample, the following output appears: Main thread: Queuing an asynchronous operation.
Main thread: Performing other operations.
WorkItem thread: Performing asynchronous operation
Main thread: Waiting for asynchronous operation to complete.
When the display is finished, the application wait for you to pressed the return key to finished the application.
Under the Hood
This application shows how to use the thread return := {THREAD_POOL}.queue_user_work_item (create {WAIT_CALLBACK}.make (Current, $async_operation, l_async_operation_done))
and is associated to the local variable l_async_operation_done
. Both threads perform simultaneously some operations. The main thread wait for the asynchronous thread to complete his own operations return := l_async_operation_done.wait_one
to close the application.
This sample uses the following .NET types:
-
THREAD_POOL -
WAIT_CALLBACK -
AUTO_RESET_EVENT
Notes
This sample is translated from the example located in the Samples\Technologies\Threading\Pools subdirectory of the .NET Framework SDK samples directory of Microsoft Visual Studio .NET.