CSharpTest.Net
SimpleReadWriteLocking Class Members
See Also  Properties  Methods  Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Synchronization Namespace : SimpleReadWriteLocking Class


Glossary Item Box

The following tables list the members exposed by SimpleReadWriteLocking.

Public Constructors

 NameDescription
Public ConstructorSimpleReadWriteLocking ConstructorOverloaded.   
Top

Public Properties

 NameDescription
Public PropertyWriteVersionChanges every time a write lock is aquired. If WriteVersion == 0, no write locks have been issued.  
Top

Public Methods

 NameDescription
Public MethodDisposePerforms application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.  
Public MethodReadOverloaded. Returns a reader lock that can be elevated to a write lock  
Public MethodReleaseReadReleases a read lock  
Public MethodReleaseWriteReleases a writer lock  
Public MethodTryReadReturns true if the lock was successfully obtained within the timeout specified  
Public MethodTryWriteReturns true if the lock was successfully obtained within the timeout specified  
Public MethodWriteOverloaded. Returns a read and write lock  
Top

Protected Methods

 NameDescription
Protected MethodWaitForExclusiveThis is the only real work to be done, once we've acquired the write lock we have to wait for all readers to complete. If/when that happens we can then own the write lock. The case where this does not take place is when a thread that already owns the lock calls us to lock again. In this case we can just return success and ignore the outstanding read requests. The major problem with this approach is that if function A() does a read-lock and calls function B() which does a write lock, this will fail. So the solution is to either use the upgradeable version (see the derived class UpgradableReadWriteLocking) and upgrade, or to start with a write lock in function A().  
Top

See Also

Generated with Document! X 2011 by Innovasys