Main Page | Modules | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | Related Pages

SbThreadAutoLock Class Reference
[Portable thread-handling abstractions]

#include <Inventor/threads/SbThreadAutoLock.h>

List of all members.


Detailed Description

Simple convenience class for locking access to a function.

This class provides a simple convenience mechanism for automatically locking access to a function that is not re-entrant.

Usage example:

  void
  myfunction(void)
  {
    SbThreadAutoLock lock(aMutexPtr);

    // [other code]
  }

In the class constructor, SbMutex::lock() is called on the mutex, and when the function exits (this is the convenience part) the destructor will automatically be invoked, calling SbMutex::unlock() on the same mutex.


Public Member Functions

 SbThreadAutoLock (SbMutex *mutex)
 ~SbThreadAutoLock ()

Protected Attributes

SbMutexmutex


Constructor & Destructor Documentation

SbThreadAutoLock::SbThreadAutoLock SbMutex mutex  )  [inline]
 

The constructor calls SbMutex::lock() on mutex.

SbThreadAutoLock::~SbThreadAutoLock  )  [inline]
 

The destructor calls SbMutex::unlock() on the mutex passed in as a parameter to the constructor.


Member Data Documentation

SbThreadAutoLock::mutex [protected]
 

This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.


The documentation for this class was generated from the following files:
Generated on Sun Dec 14 15:51:26 2003 for Coin by doxygen 1.3.3