1/* -*-c++-*- OpenThreads library, Copyright (C) 2002 - 2007 The Open Thread Group
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
16// Condition - C++ condition class
20#ifndef _OPENTHREADS_CONDITION_
21#define _OPENTHREADS_CONDITION_
23#include <OpenThreads/Exports>
24#include <OpenThreads/Mutex>
26namespace OpenThreads {
30 * @brief This class provides an object-oriented thread condition interface.
32class OPENTHREAD_EXPORT_DIRECTIVE Condition {
49 virtual int wait(Mutex *mutex);
52 * Wait on a mutex for a given amount of time (ms)
54 * @return 0 if normal, -1 if errno set, errno code otherwise.
56 virtual int wait(Mutex *mutex, unsigned long int ms);
59 * Signal a SINGLE thread to wake if it's waiting.
61 * @return 0 if normal, -1 if errno set, errno code otherwise.
66 * Wake all threads waiting on this condition.
68 * @return 0 if normal, -1 if errno set, errno code otherwise.
70 virtual int broadcast();
75 * Private copy constructor, to prevent tampering.
77 Condition(const Condition &/*c*/) {};
80 * Private copy assignment, to prevent tampering.
82 Condition &operator=(const Condition &/*c*/) {return *(this);};
85 * Implementation-specific data
93#endif // !_OPENTHREADS_CONDITION_