.TH "ost::SemaphoreLock" 3 "Sun Dec 27 2020" "GNU CommonC++" \" -*- nroff -*- .ad l .nh .SH NAME ost::SemaphoreLock \- The \fBSemaphoreLock\fP class is used to protect a section of code through a semaphore so that only x instances of the member function may execute concurrently\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBSemaphoreLock\fP (\fBSemaphore\fP &_sem)" .br .RI "Wait for the semaphore\&. " .ti -1c .RI "\fB~SemaphoreLock\fP ()" .br .RI "Post the semaphore automatically\&. " .in -1c .SH "Detailed Description" .PP The \fBSemaphoreLock\fP class is used to protect a section of code through a semaphore so that only x instances of the member function may execute concurrently\&. A common use is .PP void func_to_protect() { \fBSemaphoreLock\fP lock(semaphore); \&.\&.\&. operation \&.\&.\&. } .PP NOTE: do not declare variable as 'SemaohoreLock (semaphore)', the mutex will be released at statement end\&. .PP \fBAuthor\fP .RS 4 David Sugar dyfet@gnu.org .RE .PP \fBSemaphore\fP automatic locker for protected access\&. .SH "Constructor & Destructor Documentation" .PP .SS "ost::SemaphoreLock::SemaphoreLock (\fBSemaphore\fP & _sem)\fC [inline]\fP" .PP Wait for the semaphore\&. .PP References ost::Semaphore::wait()\&. .SS "ost::SemaphoreLock::~SemaphoreLock ()\fC [inline]\fP" .PP Post the semaphore automatically\&. .PP References ost::Semaphore::post()\&. .SH "Author" .PP Generated automatically by Doxygen for GNU CommonC++ from the source code\&.