Synchronization
[Utilities]


Data Structures

struct  tag_rwlock
 A read/write lock. More...

Typedefs

typedef tag_rwlock rw_lock_t
 A read/write lock.
typedef rw_lock_t RWLOCK
typedef rw_lock_tPRWLOCK

Functions

KHMEXP void KHMAPI InitializeRwLock (PRWLOCK pLock)
 Initialize a read/write lock.
KHMEXP void KHMAPI DeleteRwLock (PRWLOCK pLock)
 Delete a read/write lock.
KHMEXP void KHMAPI LockObtainRead (PRWLOCK pLock)
 Obtains a read lock on the read/write lock.
KHMEXP void KHMAPI LockReleaseRead (PRWLOCK pLock)
 Relase a read lock obtained on a read/write lock.
KHMEXP void KHMAPI LockObtainWrite (PRWLOCK pLock)
 Obtains a write lock on the read/write lock.
KHMEXP void KHMAPI LockReleaseWrite (PRWLOCK pLock)
 Relase a write lock obtained on a read/write lock.


Typedef Documentation

typedef struct tag_rwlock rw_lock_t

A read/write lock.

A classic read/write lock. Allows multiple readers or a single writer to access a protected object. Readers will wait for any pending writer to release the lock, while a writer will wait for any pending readers to release the lock.


Function Documentation

KHMEXP void KHMAPI DeleteRwLock ( PRWLOCK  pLock  ) 

Delete a read/write lock.

Once the application is done using the read/write lock, it must be deleted with a call to DeleteRwLock()

KHMEXP void KHMAPI InitializeRwLock ( PRWLOCK  pLock  ) 

Initialize a read/write lock.

A lock must be initialized before it can be used. Initializing the lock does not grant the caller any locks on the object.

KHMEXP void KHMAPI LockObtainRead ( PRWLOCK  pLock  ) 

Obtains a read lock on the read/write lock.

Multiple readers can obtain read locks on the same r/w lock. However, if any thread attempts to obtain a write lock on the object, it will wait until all readers have released the read locks.

Call LockReleaseRead() to release the read lock. While the same thread may obtain multiple read locks on the same object, each call to LockObtainRead() must have a corresponding call to LockReleaseRead() to properly relinquish the lock.

See also:
LockReleaseRead()

KHMEXP void KHMAPI LockObtainWrite ( PRWLOCK  pLock  ) 

Obtains a write lock on the read/write lock.

Only a single writer is allowed to lock a single r/w lock. However, if any thread attempts to obtain a read lock on the object, it will wait until the writer has released the lock.

Call LockReleaseWrite() to release the write lock. While the same thread may obtain multiple write locks on the same object, each call to LockObtainWrite() must have a corresponding call to LockReleaseWrite() to properly relinquish the lock.

See also:
LockReleaseWrite()

KHMEXP void KHMAPI LockReleaseRead ( PRWLOCK  pLock  ) 

Relase a read lock obtained on a read/write lock.

Each call to LockObtainRead() must have a corresponding call to LockReleaseRead(). Once all read locks are released, any threads waiting on write locks on the object will be woken and assigned a write lock.

See also:
LockObtainRead()

KHMEXP void KHMAPI LockReleaseWrite ( PRWLOCK  pLock  ) 

Relase a write lock obtained on a read/write lock.

Each call to LockObtainWrite() must have a corresponding call to LockReleaseWrite(). Once the write lock is released, any threads waiting for read or write locks on the object will be woken and assigned the proper lock.

See also:
LockObtainWrite()


Generated on Fri Aug 3 08:27:14 2007 for Network Identity Manager by Doxygen 1.5.2
© 2004-2007 Massachusetts Institute of Technology.
© 2005-2007 Secure Endpoints Inc.
Contact khimaira@mit.edu