Fawkes API  Fawkes Development Version
wait_condition.h
1 
2 /***************************************************************************
3  * wait_condition.h - condition variable implementation
4  *
5  * Created: Thu Sep 14 21:34:58 2006
6  * Copyright 2006-2009 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef __CORE_THREADING_WAIT_CONDITION_H_
25 #define __CORE_THREADING_WAIT_CONDITION_H_
26 
27 namespace fawkes {
28 
29 class WaitConditionData;
30 class Mutex;
31 
33  public:
34  WaitCondition(Mutex *mutex = 0);
36 
37  void wait();
38  bool abstimed_wait(long int sec, long int nanosec);
39  bool reltimed_wait(unsigned int sec, unsigned int nanosec);
40 
41  void wake_one();
42  void wake_all();
43 
44  private:
45  WaitConditionData *__cond_data;
46  Mutex *__mutex;
47  bool __own_mutex;
48 };
49 
50 
51 } // end namespace fawkes
52 
53 #endif
Wait until a given condition holds.
bool reltimed_wait(unsigned int sec, unsigned int nanosec)
Wait with relative timeout.
WaitCondition(Mutex *mutex=0)
Constructor.
~WaitCondition()
Destructor.
Fawkes library namespace.
void wake_all()
Wake up all waiting threads.
void wake_one()
Wake another thread waiting for this condition.
void wait()
Wait for the condition forever.
Mutex mutual exclusion lock.
Definition: mutex.h:32
bool abstimed_wait(long int sec, long int nanosec)
Wait with absolute timeout.