#include <thread.h>
Public Member Functions | |
ReadLock (ThreadLock &_tl) | |
Wait for read access. | |
~ReadLock () | |
Post the semaphore automatically. |
The ThreadLock is automatically released when the object falls out of scope.
A common use is
void func_to_protect() { ReadLock lock(threadlock); ... operation ... }
NOTE: do not declare variable as "ReadLock (threadlock)", the mutex will be released at statement end.
|
Wait for read access.
|
|
Post the semaphore automatically.
|