class CMultiLock

More...

Definition#include <classlib/include/classlib/mtsync.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Protected Members


Detailed Description

class CMultiLock

It's a locker object. The class CMultiLock try to acquire ALL the object passed as parameter.


	Example:
	
	...
	...
	CMutex mtx1;
	...
	...
	CMutex mtx2;
	...
	...
	// this function acquire the mutexes and release them before return to the caller.
	int mySynchronizedFun()
	{
	    CSyncObject* lobj[] = {&mtx1, &mtx2};
	    CMultiLock mlck(lobj, 2, TRUE);
	    ...
	    ...
	    if(someCondition)
	        return -1;
	    ...
	    ...
	    return 0;
	}
	...
	...


 CMultiLock (CSyncObject* ppObjects[], DWORD dwCount, BOOL bInitialLock = FALSE)

CMultiLock

Build the locker. If bInitialLock is TRUE try to acquire immediately all synchronization objects.

 ~CMultiLock ()

~CMultiLock

[virtual]

Destroy the locker, releasing all synchronization objects.

DWORD  Lock (DWORD dwTimeOut = INFINITE, BOOL bWaitForAll = TRUE, DWORD dwWakeMask = 0)

Lock

Lock all synchronization objects.

BOOL  Unlock ()

Unlock

Unlock all synchronization objects.

BOOL  Unlock (LONG lCount, LPLONG lPrevCount = NULL)

Unlock

Unlock all synchronization objects.

BOOL  IsLocked (DWORD dwItem)

IsLocked

[const]

Return TRUE if the specifid item is locked.

CSyncObject** m_ppObjectArray

m_ppObjectArray

[protected]

BOOL* m_bLockedArray

m_bLockedArray

[protected]

DWORD m_dwCount

m_dwCount

[protected]


Generated by: nicola on gulliver.wadahome.it on Sun May 25 13:54:34 2003, using kdoc 2.0a53.