Method | Description | |
---|---|---|
FlipPhase ( ) : void |
Flip a phase in the WriterReaderPhaser instance, FlipPhase() can only be called while holding the ReaderLock(). FlipPhase() will return only after all writer critical sections (protected by WriterCriticalSectionEnter() and WriterCriticalSectionExit(long) that may have been in flight when the FlipPhase(System.TimeSpan) call were made had completed. No actual writer critical section activity is required for FlipPhase() to succeed. However, FlipPhase() is lock-free with respect to calls to WriterCriticalSectionEnter() and WriterCriticalSectionExit(long). It may spin-wait for for active writer critical section code to complete. |
|
FlipPhase ( System.TimeSpan yieldPeriod ) : void |
Flip a phase in the WriterReaderPhaser instance, FlipPhase(System.TimeSpan) can only be called while holding the ReaderLock(). FlipPhase(System.TimeSpan) will return only after all writer critical sections (protected by WriterCriticalSectionEnter() and WriterCriticalSectionExit(long) that may have been in flight when the FlipPhase(System.TimeSpan) call were made had completed. No actual writer critical section activity is required for FlipPhase(System.TimeSpan) to succeed. However, FlipPhase(System.TimeSpan) is lock-free with respect to calls to WriterCriticalSectionEnter() and WriterCriticalSectionExit(long). It may spin-wait for for active writer critical section code to complete. |
|
ReaderLock ( ) : void |
Enter to a critical section containing a read operation (mutually excludes against other ReaderLock() calls). ReaderLock DOES NOT provide synchronization against WriterCriticalSectionEnter calls. Use FlipPhase() to synchronize reads against writers.
|
|
ReaderUnlock ( ) : void |
Exit from a critical section containing a read operation(relinquishes mutual exclusion against other ReaderLock() calls).
|
|
WriterCriticalSectionEnter ( ) : long |
Indicate entry to a critical section containing a write operation. This call is wait-free on architectures that support wait free atomic increment operations, and is lock-free on architectures that do not. WriterCriticalSectionEnter must be matched with a subsequent WriterCriticalSectionExit in order for CriticalSectionPhaser synchronization to function properly. The IDisposable pattern could have been used but was not due to the high allocation count it would have incurred. |
|
WriterCriticalSectionExit ( long criticalValueAtEnter ) : void |
Indicate exit from a critical section containing a write operation. This call is wait-free on architectures that support wait free atomic increment operations, and is lock-free on architectures that do not. WriterCriticalSectionExit(long) must be matched with a preceding WriterCriticalSectionEnter call, and must be provided with the matching WriterCriticalSectionEnter call's return value, in order for CriticalSectionPhaser synchronization to function properly. |
Method | Description | |
---|---|---|
GetAndIncrement ( long &value ) : long | ||
GetAndSet ( long &value, long newValue ) : long | ||
LazySet ( long &value, long newValue ) : void |
public FlipPhase ( System.TimeSpan yieldPeriod ) : void | ||
yieldPeriod | System.TimeSpan | The amount of time to sleep in each yield if yield loop is needed. |
return | void |
public WriterCriticalSectionExit ( long criticalValueAtEnter ) : void | ||
criticalValueAtEnter | long | the opaque value (token) returned from the matching |
return | void |