logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

ost::MutexLock - The MutexLock class is used to protect a section of code so that at any given time only

Author

       Generated automatically by Doxygen for GNU CommonC++ from the source code.

GNU CommonC++                                    Sun Dec 27 2020                               ost::MutexLock(3)

Constructor & Destructor Documentation

ost::MutexLock::MutexLock(Mutex&_mutex)[inline]
       Acquire the mutex.

       Parameters_mutex reference to mutex to aquire.

       References ost::Mutex::enterMutex().

   ost::MutexLock::~MutexLock()[inline]
       Release the mutex automatically.

       References ost::Mutex::leaveMutex().

Detailed Description

       The MutexLock 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 Mutex 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.

       A common use is

       void func_to_protect() { MutexLocklock(mutex); ... operation ... }

       NOTE: do not declare variable as 'MutexLock (mutex)', the mutex will be released at statement end.

       Author
           Frediano Ziglio freddy77@angelfire.comMutex automatic locker for protected access.

Name

       ost::MutexLock - The MutexLock class is used to protect a section of code so that at any given time only
       a single thread can perform the protected operation.

Synopsis

       #include <thread.h>

   PublicMemberFunctionsMutexLock (Mutex &_mutex)
           Acquire the mutex.
       ~MutexLock ()
           Release the mutex automatically.

See Also