MITHREAD::READWRITESYNC::WRITELOCK Class Reference

Write Lock class to obtain and hold a write lock on the READWRITESYNC object until dtor is called Only one thread can obtain a write lock at a time. More...

#include <mi32/readwritelock.h>

List of all members.

Public Member Functions

 WRITELOCK (READWRITESYNC &rwsync, bool bInitialLock=true, bool bTryLock=false)
 WRITELOCK ()
 ~WRITELOCK ()
bool IsLocked () const
void Lock (READWRITESYNC &rwsync)
void Lock ()
bool TryLock (READWRITESYNC &rwsync)
bool TryLock ()
void Unlock ()

Detailed Description

Write Lock class to obtain and hold a write lock on the READWRITESYNC object until dtor is called Only one thread can obtain a write lock at a time.


Constructor & Destructor Documentation

MITHREAD::READWRITESYNC::WRITELOCK::WRITELOCK (  ) 

Default ctor.

MITHREAD::READWRITESYNC::WRITELOCK::WRITELOCK ( READWRITESYNC rwsync,
bool  bInitialLock = true,
bool  bTryLock = false 
)

Pre-init ctor Default ctor.

Parameters:
rwsync Synchronization read/write object to obtain a write lock on
bInitialLock Get a lock on ctor call, false to obtain one later
bTryLock Use try lock semantics, call IsLocked() to determine if lock is granted, recursion support must be enabled
MITHREAD::READWRITESYNC::WRITELOCK::~WRITELOCK (  ) 

Default dtor, will release the lock if IsLocked() == true.


Member Function Documentation

bool MITHREAD::READWRITESYNC::WRITELOCK::IsLocked (  )  const [inline]

Determine that a lock was obtained, only useful if ctor is passed 'true' for bTryLock parameter.

void MITHREAD::READWRITESYNC::WRITELOCK::Lock ( READWRITESYNC rwsync  ) 

Obtains a lock on READWRITESYNC object passed in.

Parameters:
rwsync Synchronization read/write object to obtain a read lock on
void MITHREAD::READWRITESYNC::WRITELOCK::Lock (  ) 

Obtains a lock on READWRITESYNC object passed in the ctor. Only useful if 'false' is passed in bInitialLock parameter.

bool MITHREAD::READWRITESYNC::WRITELOCK::TryLock ( READWRITESYNC rwsync  ) 

Attempts to obtain a lock on READWRITESYNC object passed in.

Only useful if recursion support is enabled.

Returns:
'True' if the lock was obtained, 'false' if not.
Parameters:
rwsync Synchronization read/write object to obtain a read lock on
bool MITHREAD::READWRITESYNC::WRITELOCK::TryLock (  ) 

Attempts to obtain a lock on READWRITESYNC object passed in the ctor.

Only useful if 'false' is passed in bInitialLock parameter and recursion support is enabled.

Returns:
'True' if the lock was obtained, 'false' if not.
void MITHREAD::READWRITESYNC::WRITELOCK::Unlock (  ) 

Releases the lock on READWRITESYNC object.


The documentation for this class was generated from the following file:

Generated on Sun Oct 7 21:36:39 2012 for TNTsdk 2012 by  doxygen 1.6.1