Go to the source code of this file.
Functions | |
class | Exchanger (Value) |
Variables | |
module mango locks | Exchanger |
Written by Doug Lea with assistance from members of JCP JSR-166 Expert Group and released to the domain, as explained at http://creativecommons.org/licenses/publicdomain Ported to D by Ben Hinkle. Email comments and bug reports to ben.hinkle@gmail.com
revision 2.0
Definition in file Exchanger.d.
|
Holder for the item being exchanged Arrival count transitions from 0 to 1 to 2 then back to 0 during an exchange. Main exchange function, handling the different policy variants. Create a new Exchanger. Waits for another thread to arrive at this exchange point and then transfers the given object to it, receiving its object in return. If another thread is already waiting at the exchange point then it is resumed for thread scheduling purposes and receives the object passed in by the current thread. The current thread returns immediately, receiving the object passed to the exchange by that other thread. If no other thread is already waiting at the exchange then the current thread is disabled for thread scheduling purposes and lies dormant until some other thread enters the exchange.
Waits for another thread to arrive at this exchange point (unless the specified waiting time elapses), and then transfers the given object to it, receiving its object in return. If another thread is already waiting at the exchange point then it is resumed for thread scheduling purposes and receives the object passed in by the current thread. The current thread returns immediately, receiving the object passed to the exchange by that other thread. If no other thread is already waiting at the exchange then the current thread is disabled for thread scheduling purposes and lies dormant until one of three things happens:
If the specified waiting time elapses then TimeoutException is thrown. If the time is less than or equal to zero, the method will not wait at all.
Definition at line 66 of file Exchanger.d. References ReentrantLock, TimeUnit, toNanos(), and x. |
|
Definition at line 14 of file Exchanger.d. |