Barracuda Application Server C/C++ Reference
Native APIs, integration guides, and platform interfaces
ThreadLock Struct Reference

Detailed Description

This class provides an easy and less error-prone way of locking and releasing a mutex.

The class should be instantiated on the stack such that the constructor locks the mutex when the scope becomes active and the destructor releases the mutex when the scope becomes inactive.

{ ThreadLock lock(dispMutex);
//Protected web-server calls here
}
This class provides an easy and less error-prone way of locking and releasing a mutex.
Definition: ThreadLib.h:124

This is a C++ class only. Use a named local variable so it lives for the intended scope. Do not copy a lock object or acquire a mutex recursively; recursive acquisition is not portable across ThreadLib implementations.

See also
ThreadMutex ThreadReleaseLock

#include <ThreadLib.h>

Public Member Functions

 ThreadLock (ThreadMutex &m)
 Acquire the mutex until scope exit. More...
 
 ThreadLock (ThreadMutex *m)
 Acquire the mutex until scope exit. More...
 
 ~ThreadLock ()
 Unlock the mutex. More...
 

Friends

struct ThreadReleaseLock