ost_WriteLock(3)

ost_WriteLock3

The writelock class is used to protect a section of code through a threadlock for 'write' access to the member function.

Usage

#include <thread.h>

Public Member Functions

WriteLock (ThreadLock &_tl)
Wait for write access. ~WriteLock ()
Post the semaphore automatically.

Detailed Description

The WriteLock class is used to protect a section of code through a ThreadLock for 'write' access to the member function.

The ThreadLock is automatically released when the object falls out of scope.

A common use is

void func_to_protect() { WriteLock lock(threadlock); ... operation ... }

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

Author

David Sugar [email protected]

Read mode automatic locker for protected access.

Constructor & Destructor Documentation

ost::WriteLock::WriteLock (ThreadLock & _tl) [inline]

Wait for write access.

Parameters

_tl reference to threadlock to aquire.

References ost::ThreadLock::writeLock().

ost::WriteLock::~WriteLock () [inline]

Post the semaphore automatically.

References ost::ThreadLock::unlock().

Releases

7 releases since Debian 4.0 (Etch); the text changed 6 times.

  1. 4.0
  2. 5.0
  3. 6.0
  4. 8
  5. 9
  6. 10
  7. 11

Author

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

From libcommoncpp2-doc 1.8.1-10 in Debian 11 (Bullseye). Parsed by carta from the page's man source.