Function CSPThreadLockHandler::Unlock()

Description:
It decrements the thread lock count by one.

Prototype:
unsigned long Unlock();

Arguments:
No arguments (void).

Return value:
It returns the current thread lock count.

Remarks:
If the thread lock count is zero, no action is taken.

Examples:
//Global scope declarations
CSPThreadLock ThreadLock;
int a = 0;
int b = 0;
...
...

//Thread sensitive code
{
CSPThreadLockHandler Handler( ThreadLock );

Handler.Lock();
a += 2;
b = b / a;
// even on a "division by zero" exception,
// the thread lock object is completely unlocked
// during the destruction of object Handler.

Handler.Unlock();
// even if you omit the line above,
// the thread lock object will be fully unlocked
// during the destruction of object Handler.
}

See also:
member functions Lock(), TryLock()
CSPThreadLockHandler | Other support classes | Class Categories | Online help home | Back

www.micronovae.com

Copyright © 2002 - 2005 Micronovae Ltd