Updated trunk

git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@2484 abb3cda0-5349-4a8f-a601-0c33ac3a8c38
This commit is contained in:
eifops
2025-02-06 17:17:32 +00:00
parent dfeab946bd
commit de6e7aad63
89 changed files with 516 additions and 129 deletions

View File

@@ -0,0 +1,5 @@
[[Property:title|Threads Samples]]
[[Property:weight|2]]
[[Property:uuid|62e36a4c-0afd-e143-9a1f-98eab4022e6b]]
Samples using .NET threading technology.

View File

@@ -0,0 +1,53 @@
[[Property:title|Pools]]
[[Property:weight|0]]
[[Property:uuid|ace044b0-1fb7-22a0-6c18-880281ed3b6d]]
This sample demonstrates use of the <eiffel>THREAD_POOL</eiffel> (ThreadPool) class. The sample queues up an asynchronous method call that is executed by a thread from the thread pool managed by the Common Language Runtime. The method "does some work" and then sets an event indicating that the work has finished. The main thread waits on the event and then exits.
==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:
<code>
Main thread: Queuing an asynchronous operation.
Main thread: Performing other operations.
WorkItem thread: Performing asynchronous operation
Main thread: Waiting for asynchronous operation to complete.
</code>
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 <eiffel>THREAD_POOL</eiffel>.
An asynchronous thread is launched:
<code>
return := {THREAD_POOL}.queue_user_work_item (create {WAIT_CALLBACK}.make (Current, $async_operation, l_async_operation_done))
</code>
and is associated to the local variable <code>l_async_operation_done</code>. Both threads perform simultaneously some operations. The main thread wait for the asynchronous thread to complete his own operations
<code>
return := l_async_operation_done.wait_one
</code> to close the application.
This sample uses the following .NET types:
* <eiffel>THREAD_POOL</eiffel>
* <eiffel>WAIT_CALLBACK</eiffel>
* <eiffel>AUTO_RESET_EVENT</eiffel>
==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.

View File

@@ -0,0 +1,51 @@
[[Property:title|Timers]]
[[Property:weight|1]]
[[Property:uuid|325ac6e6-9660-891c-2605-dbeb621649f0]]
This sample consist in a command line demonstrating the use of the <eiffel>TIMER</eiffel> (Timer) class to generate a periodic callback to a method. The sample creates a <eiffel>TIMER</eiffel> object and passes to it a delegate object. When the <eiffel>TIMER</eiffel> fires, the delegate is invoked, and a static method is called asynchronously by a worker thread in the thread pool.
==Compiling==
To compile the example:
# Launch EiffelStudio.
# Click '''Add project'''
# Browse to ''$ISE_EIFFEL\examplesdotnet\threading\timers\''
# Choose ''timers.ecf''
# Choose the location where the project will be compiled, by default the same directory containing the configuration file.
# Click '''Open'''.
==Running==
After you launch the sample, the following output appears:
<code>
Checking for status updates every two seconds
<Hit Enter to terminate the sample>
Checking Status.
Checking Status.
Checking Status.
Checking Status.
Checking Status.
...
</code>
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 <eiffel>TIMER</eiffel>. The timer is launched:
<code>
create my_timer.make_with_callback (create {TIMER_CALLBACK}.make (Current, $check_status), Void, 0, 2000)
</code>
and calls the feature <eiffel>check_status</eiffel> that displays the message <code>"Checking Status."</code> every two seconds.
This sample uses the following .NET types:
* <eiffel>TIMER</eiffel>
* <eiffel>TIMER_CALLBACK</eiffel>
==Notes==
This sample is translated from the example located in the Samples\Technologies\Threading\Timers subdirectory of the .NET Framework SDK samples directory of Microsoft Visual Studio .NET.