InterprocessReaderWriterLock Class

Represents an inter-process reader/writer lock using NamedSemaphore and Mutex native locking mechanisms.

Definition

Namespace: Gemstone.Threading
Assembly: Gemstone.Threading (in Gemstone.Threading.dll) Version: 1.0.110 -- Release Build+13c244059615c58a533059438f38d7e59ef0c2ea
public class InterprocessReaderWriterLock : IDisposable
Inheritance
Object    InterprocessReaderWriterLock
Implements
IDisposable

Remarks

The InterprocessReaderWriterLock uses a NamedSemaphore to synchronize access to an inter-process shared resource. On POSIX systems, the NamedSemaphore exhibits kernel persistence, meaning instances will remain active beyond the lifespan of the creating process. The named semaphore must be explicitly removed by invoking ReleaseInterprocessResources when the last reader-writer lock instance is no longer needed. Kernel persistence necessitates careful design consideration regarding process responsibility for invoking the ReleaseInterprocessResources method. Since the common use case for named semaphores is across multiple applications, it is advisable for the last exiting process to handle the cleanup. In cases where an application may crash before calling the ReleaseInterprocessResources method, the semaphore persists in the system, potentially leading to resource leakage. Implementations should include strategies to address and mitigate this risk.

Constructors

InterprocessReaderWriterLock(String, Boolean) Creates a new instance of the InterprocessReaderWriterLock associated with the specified name that identifies a source object needing concurrency locking.
InterprocessReaderWriterLock(String, Int32, Boolean) Creates a new instance of the InterprocessReaderWriterLock associated with the specified name that identifies a source object needing concurrency locking.

Properties

MaximumConcurrentLocks Gets the maximum concurrent reader locks allowed.

Methods

Dispose Releases all the resources used by the InterprocessReaderWriterLock object.
Dispose(Boolean) Releases the unmanaged resources used by the InterprocessReaderWriterLock object and optionally releases the managed resources.
EnterReadLock Tries to enter the lock in read mode.
EnterWriteLock Tries to enter the lock in write mode.
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
ExitReadLock Exits read mode and returns the prior read lock count.
ExitWriteLock Exits write mode.
Finalize Releases the unmanaged resources before the InterprocessReaderWriterLock object is reclaimed by GC.
(Overrides ObjectFinalize)
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetTypeGets the Type of the current instance.
(Inherited from Object)
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
ReleaseInterprocessResources Releases inter-process resources used by the InterprocessReaderWriterLock.
ToStringReturns a string that represents the current object.
(Inherited from Object)
TryEnterReadLock Tries to enter the lock in read mode, with an optional time-out.
TryEnterWriteLock Tries to enter the lock in write mode, with an optional time-out.

Fields

DefaultMaximumConcurrentLocks Default maximum concurrent locks allowed for InterprocessReaderWriterLock.

See Also