* Adding static Notify{One,All} functions. This allows a cleaner implementation
of the condition variable and synchronization subsystem of the freebsd compat layer which will be committed next. * Also there was a discussion about adding these functions on the commit mailing list. The mail in http://www.freelists.org/post/haiku-commits/r34395-in-haikutrunksrclibscompatfreebsd-network-compatsys,3 is a good sum up of it (need to scroll somewhat down, though). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34458 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -63,6 +63,13 @@ public:
|
|||||||
inline void NotifyAll(bool threadsLocked = false,
|
inline void NotifyAll(bool threadsLocked = false,
|
||||||
status_t result = B_OK);
|
status_t result = B_OK);
|
||||||
|
|
||||||
|
static void NotifyOne(const void* object,
|
||||||
|
bool threadsLocked = false,
|
||||||
|
status_t result = B_OK);
|
||||||
|
static void NotifyAll(const void* object,
|
||||||
|
bool threadsLocked = false,
|
||||||
|
status_t result = B_OK);
|
||||||
|
|
||||||
void Add(ConditionVariableEntry* entry);
|
void Add(ConditionVariableEntry* entry);
|
||||||
|
|
||||||
status_t Wait(uint32 flags = 0, bigtime_t timeout = 0);
|
status_t Wait(uint32 flags = 0, bigtime_t timeout = 0);
|
||||||
|
|||||||
@@ -261,6 +261,34 @@ ConditionVariable::Wait(uint32 flags, bigtime_t timeout)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ConditionVariable::NotifyOne(const void* object, bool threadsLocked,
|
||||||
|
status_t result)
|
||||||
|
{
|
||||||
|
InterruptsSpinLocker locker(sConditionVariablesLock);
|
||||||
|
ConditionVariable* variable = sConditionVariableHash.Lookup(object);
|
||||||
|
locker.Unlock();
|
||||||
|
if (variable == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
variable->NotifyOne(threadsLocked, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ConditionVariable::NotifyAll(const void* object,
|
||||||
|
bool threadsLocked, status_t result)
|
||||||
|
{
|
||||||
|
InterruptsSpinLocker locker(sConditionVariablesLock);
|
||||||
|
ConditionVariable* variable = sConditionVariableHash.Lookup(object);
|
||||||
|
locker.Unlock();
|
||||||
|
if (variable == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
variable->NotifyAll(threadsLocked, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*static*/ void
|
/*static*/ void
|
||||||
ConditionVariable::ListAll()
|
ConditionVariable::ListAll()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user