| http://www.sim.no/ http://www.coin3d.org/

Public Types | Public Member Functions | List of all members
SbRWMutex Class Reference
Portable Threads Abstraction Classes

`#include <Inventor/threads/SbRWMutex.h>`

## Public Types

enum | Precedence { READ_PRECEDENCE, WRITE_PRECEDENCE }

## Public Member Functions

| SbRWMutex (Precedence policy)
| ~SbRWMutex (void)
int | writeLock (void)
SbBool | tryWriteLock (void)
int | writeUnlock (void)
int | readLock (void)
int | tryReadLock (void)
int | readUnlock (void)

## Detailed Description

The SbRWMutex is a mutex that is used to grant both read and write access to the data it protects. Multiple threads can have read locks on the data at once, but only one write-lock can be given out and not while a thread has a read lock on the data.

The policy on granting read locks to threads when a thread is waiting for the write lock is something that should be configurable at construction time but which isn't at the moment.

## Constructor & Destructor Documentation

## ◆ SbRWMutex()

SbRWMutex::SbRWMutex | ( | Precedence | policy | ) |

inline

Constructor.

## ◆ ~SbRWMutex()

SbRWMutex::~SbRWMutex | ( | void |  | ) |

inline

Destructor.

## Member Function Documentation

## ◆ writeLock()

int SbRWMutex::writeLock | ( | void |  | ) |

inline

This method blocks the calling thread until it gains write lock status on the SbRWMutex object.

## ◆ tryWriteLock()

SbBool SbRWMutex::tryWriteLock | ( | void |  | ) |

inline

This method tries to gain write lock status on the SbRWMutex. TRUE is returned if it was successful, FALSE otherwise. This is a non-blocking operation.

## ◆ writeUnlock()

int SbRWMutex::writeUnlock | ( | void |  | ) |

inline

This method is used for unlocking the calling thread's write lock.

## ◆ readLock()

int SbRWMutex::readLock | ( | void |  | ) |

inline

This method blocks the calling thread until it gains read lock status on the SbRWMutex object.

## ◆ tryReadLock()

SbBool SbRWMutex::tryReadLock | ( | void |  | ) |

inline

This method tries to gain read lock status on the SbRWMutex. TRUE is returned if it was successful, FALSE otherwise. This is a non-blocking operation.

## ◆ readUnlock()

int SbRWMutex::readUnlock | ( | void |  | ) |

inline

This method is used for unlocking the calling thread's read lock.

The documentation for this class was generated from the following files:

- SbRWMutex.h
- rwmutex.cpp

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