SbMutex(3) Coin SbMutex(3)NAME
SbMutex -
A basic class for managing a mutex.
This class provides a portable framework around the mutex interface of the underlying native thread-handling toolkit.
SYNOPSIS
#include <Inventor/threads/SbMutex.h>
Public Member Functions
SbMutex (void)
~SbMutex ()
int lock (void)
SbBool tryLock (void)
int unlock (void)
Detailed Description
A basic class for managing a mutex.
This class provides a portable framework around the mutex interface of the underlying native thread-handling toolkit.
Constructor & Destructor Documentation
SbMutex::SbMutex (void) [inline]
Constructor.
SbMutex::~SbMutex () [inline]
Destructor.
Member Function Documentation
int SbMutex::lock (void) [inline]
This method locks the mutex. 0 is returned on success.
If the mutex was previously unlocked, the thread will lock the mutex and continue running. If the mutex was already locked when this call
is made, the thread will be suspended until the other thread holding the mutex releases it.
This is a blocking operation.
SbBool SbMutex::tryLock (void) [inline]
This method tries to lock the mutex, and returns whether it was locked or not. This is a non-blocking operation.
int SbMutex::unlock (void) [inline]
This method unlocks the mutex.
Author
Generated automatically by Doxygen for Coin from the source code.
Version 3.1.3 Wed May 23 2012 SbMutex(3)
Check Out this Related Man Page
SbCondVar(3) Coin SbCondVar(3)NAME
SbCondVar -
A class for synchronizing access to global variables.
Condition variables are used to protect global variables in an environment where multiple threads are running concurrently.
SYNOPSIS
#include <Inventor/threads/SbCondVar.h>
Public Member Functions
SbCondVar (void)
~SbCondVar (void)
SbBool wait (SbMutex &mutex)
SbBool timedWait (SbMutex &mutex, SbTime period)
void wakeOne (void)
void wakeAll (void)
Detailed Description
A class for synchronizing access to global variables.
Condition variables are used to protect global variables in an environment where multiple threads are running concurrently.
Constructor & Destructor Documentation
SbCondVar::SbCondVar (void) [inline]
Constructor.
SbCondVar::~SbCondVar (void) [inline]
Destructor.
Member Function Documentation
SbBool SbCondVar::wait (SbMutex &mutex) [inline]
This method blocks the calling thread until another thread calls wakeOne() or wakeAll() on the SbCondVar object.
SbBool SbCondVar::timedWait (SbMutex &mutex, SbTimeperiod) [inline]
This method blocks the calling thread until another thread calls wakeOne() or wakeAll() on the object, but if this does not happen within
period, the thread is woken again anyways.
TRUE is returned when the thread wakes because either wakeOne() or wakeAll() was called, FALSE is returned if the wait times out.
void SbCondVar::wakeOne (void) [inline]
This method wakes up one of the threads waiting on this SbCondVar.
void SbCondVar::wakeAll (void) [inline]
This method wakes up all the threads waiting on this SbCondVar.
Author
Generated automatically by Doxygen for Coin from the source code.
Version 3.1.3 Wed May 23 2012 SbCondVar(3)
Hi all,
I have a scenario where I need to use the mutex locks. The mutex locks are working fine, but sometimes I am getting into the dead lock situation.
Below is the summary of my code :
MUTEX LOCK
performTask();
MUTEX UNLOCK.
In some cases I get into the situation where... (2 Replies)
Discussion started by: cjjoy
2 Replies
2. Post Here to Contact Site Administrators and Moderators
Hi,
Suppose I have a function that accesses and increments a global variable . This function is run as part of thread. One locks mutex in the function and unlocks it after the processing is done. Is there any alternative way? Thanks in advance. (1 Reply)