mirror of
https://github.com/EiffelSoftware/eiffel-org.git
synced 2025-12-08 15:52:26 +01:00
Author:Peter Gummer
Date:2010-01-05T22:09:33.000000Z git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@385 abb3cda0-5349-4a8f-a601-0c33ac3a8c38
This commit is contained in:
@@ -11,15 +11,13 @@ Then the once feature is not initialized once per process but once per thread. Y
|
|||||||
|
|
||||||
==Once per Process/Thread==
|
==Once per Process/Thread==
|
||||||
|
|
||||||
Current once features in Eiffel are once per thread. This means that when a once feature is called in a thread, the Eiffel run-time will check whether it has been already computed in this thread. If not, the once feature will be initialized and computed. This seems to be a relevant way of managing once features in multithreaded mode: most of the time, a once called in a thread is not likely to share its result.
|
By default, once features are once per thread. This means that when a once feature is called in a thread, the Eiffel run-time will check whether it has been already computed in this thread. If not, the once feature will be initialized and computed. This corresponds to the most commonly desired behavior for once features in multithreaded mode: most of the time, a once called in a thread is not likely to share its result with other threads.
|
||||||
|
|
||||||
However, in some cases, we need to share once features.
|
This is only the default, however: you have a choice between "once per thread" and "once per process"
|
||||||
|
|
||||||
Moreover, an Eiffel programmer should be able to have an alternative between a once per thread or per process implementation.
|
==Specifying once per process or once per thread ==
|
||||||
|
|
||||||
==Using Once per process/thread features in EIFFEL==
|
Here is what you will do to define a feature as a once per process:
|
||||||
|
|
||||||
Here is what you will do to implement a once per process feature:
|
|
||||||
<code>
|
<code>
|
||||||
class
|
class
|
||||||
TEST_ONCE_PER_PROCESS
|
TEST_ONCE_PER_PROCESS
|
||||||
|
|||||||
Reference in New Issue
Block a user