.TH "ost::MutexLock" 3 "Sun Dec 27 2020" "GNU CommonC++" \" -*- nroff -*- .ad l .nh .SH NAME ost::MutexLock \- The \fBMutexLock\fP class is used to protect a section of code so that at any given time only a single thread can perform the protected operation\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBMutexLock\fP (\fBMutex\fP &_mutex)" .br .RI "Acquire the mutex\&. " .ti -1c .RI "\fB~MutexLock\fP ()" .br .RI "Release the mutex automatically\&. " .in -1c .SH "Detailed Description" .PP The \fBMutexLock\fP class is used to protect a section of code so that at any given time only a single thread can perform the protected operation\&. It use \fBMutex\fP to protect operation\&. Using this class is usefull and exception safe\&. The mutex that has been locked is automatically released when the function call stack falls out of scope, so one doesnt have to remember to unlock the mutex at each function return\&. .PP A common use is .PP void func_to_protect() { \fBMutexLock\fP lock(mutex); \&.\&.\&. operation \&.\&.\&. } .PP NOTE: do not declare variable as 'MutexLock (mutex)', the mutex will be released at statement end\&. .PP \fBAuthor\fP .RS 4 Frediano Ziglio freddy77@angelfire.com .RE .PP \fBMutex\fP automatic locker for protected access\&. .SH "Constructor & Destructor Documentation" .PP .SS "ost::MutexLock::MutexLock (\fBMutex\fP & _mutex)\fC [inline]\fP" .PP Acquire the mutex\&. .PP \fBParameters\fP .RS 4 \fI_mutex\fP reference to mutex to aquire\&. .RE .PP .PP References ost::Mutex::enterMutex()\&. .SS "ost::MutexLock::~MutexLock ()\fC [inline]\fP" .PP Release the mutex automatically\&. .PP References ost::Mutex::leaveMutex()\&. .SH "Author" .PP Generated automatically by Doxygen for GNU CommonC++ from the source code\&.