Function CSPThreadLockHandler::CSPThreadLockHandler()

Description:
Creates a thread lock handler object, and attaches a thread lock object.

Prototype:
CSPThreadLockHandler(CSPThreadLockBase& TL);

Arguments:
  • CSPThreadLockBase& TL [IN]
    The CSPThreadLockBase object to handle.



Return value:
No value is returned.

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.
}
CSPThreadLockHandler | Other support classes | Class Categories | Online help home | Back

www.micronovae.com

Copyright © 2002 - 2005 Micronovae Ltd