Coin Logo http://www.sim.no/
http://www.coin3d.org/

SbThreadAutoLock Class Reference

Simple convenience class for locking access to a function. More...

#include <Inventor/threads/SbThreadAutoLock.h>

Public Member Functions

 SbThreadAutoLock (SbMutex *mutexptr)
 
 SbThreadAutoLock (SbThreadMutex *mutexptr)
 
 ~SbThreadAutoLock ()
 

Protected Attributes

SbMutexmutex
 
SbThreadMutex * recmutex
 

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]
}
Simple convenience class for locking access to a function.
Definition SbThreadAutoLock.h:31

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.

Constructor & Destructor Documentation

◆ SbThreadAutoLock() [1/2]

SbThreadAutoLock::SbThreadAutoLock ( SbMutex * mutex)
inline

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

◆ SbThreadAutoLock() [2/2]

SbThreadAutoLock::SbThreadAutoLock ( SbThreadMutex * mutex)
inline

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

◆ ~SbThreadAutoLock()

SbThreadAutoLock::~SbThreadAutoLock ( )
inline

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

Member Data Documentation

◆ recmutex

SbThreadMutex* SbThreadAutoLock::recmutex
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:

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.

Generated on Wed Jul 17 2024 for Coin by Doxygen 1.12.0.