* Added support for timeouts.

* Added support for non-published condition variables. One has to call
  Init() on those, and add entries directly with the
  ConditionVariable::Add() method.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25110 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2008-04-22 21:46:23 +00:00
parent f842b6fa57
commit 023bf5fcda
2 changed files with 62 additions and 20 deletions
+15 -2
View File
@@ -28,11 +28,17 @@ public:
#endif
bool Add(const void* object, uint32 flags = 0);
status_t Wait();
status_t Wait(const void* object, uint32 flags = 0);
status_t Wait(uint32 timeoutFlags = 0,
bigtime_t timeout = 0);
status_t Wait(const void* object, uint32 flags = 0,
bigtime_t timeout = 0);
inline ConditionVariable* Variable() const { return fVariable; }
private:
inline void AddToVariable(ConditionVariable* variable,
uint32 flags);
private:
ConditionVariable* fVariable;
struct thread* fThread;
@@ -43,6 +49,10 @@ private:
class ConditionVariable : protected HashTableLink<ConditionVariable> {
public:
void Init(const void* object,
const char* objectType);
// for anonymous (unpublished) cvars
void Publish(const void* object,
const char* objectType);
void Unpublish(bool threadsLocked = false);
@@ -50,6 +60,9 @@ public:
inline void NotifyOne(bool threadsLocked = false);
inline void NotifyAll(bool threadsLocked = false);
void Add(ConditionVariableEntry* entry,
uint32 flags = 0);
const void* Object() const { return fObject; }
static void ListAll();