kernel/condition_variable: Various cleanups.
* Adjust a comment that now goes with 3 functions and not just 1. * Remove spinlock switch function, this is useless as it cannot change interrupt states here, but we require interrupts to be enabled to wait on a ConditionVariable. * Remove WaitStatus function from ConditionVariableEntry; unused and would require locks anyway. * Implement Publish using Init.
This commit is contained in:
@@ -33,8 +33,6 @@ public:
|
||||
status_t Wait(const void* object, uint32 flags = 0,
|
||||
bigtime_t timeout = 0);
|
||||
|
||||
inline status_t WaitStatus() const { return fWaitStatus; }
|
||||
|
||||
inline ConditionVariable* Variable() const { return fVariable; }
|
||||
|
||||
private:
|
||||
@@ -71,12 +69,10 @@ public:
|
||||
|
||||
void Add(ConditionVariableEntry* entry);
|
||||
|
||||
// Convenience methods, no ConditionVariableEntry required.
|
||||
status_t Wait(uint32 flags = 0, bigtime_t timeout = 0);
|
||||
// all-in one, i.e. doesn't need a
|
||||
// ConditionVariableEntry
|
||||
status_t Wait(mutex* lock, uint32 flags = 0, bigtime_t timeout = 0);
|
||||
status_t Wait(recursive_lock* lock, uint32 flags = 0, bigtime_t timeout = 0);
|
||||
status_t Wait(spinlock* lock, uint32 flags = 0, bigtime_t timeout = 0);
|
||||
|
||||
const void* Object() const { return fObject; }
|
||||
const char* ObjectType() const { return fObjectType; }
|
||||
|
||||
@@ -265,15 +265,7 @@ ConditionVariable::Publish(const void* object, const char* objectType)
|
||||
{
|
||||
ASSERT(object != NULL);
|
||||
|
||||
fObject = object;
|
||||
fObjectType = objectType;
|
||||
new(&fEntries) EntryList;
|
||||
fEntriesCount = 0;
|
||||
B_INITIALIZE_SPINLOCK(&fLock);
|
||||
|
||||
T_SCHEDULING_ANALYSIS(InitConditionVariable(this, object, objectType));
|
||||
NotifyWaitObjectListeners(&WaitObjectListener::ConditionVariableInitialized,
|
||||
this);
|
||||
Init(object, objectType);
|
||||
|
||||
InterruptsWriteSpinLocker _(sConditionVariableHashLock);
|
||||
|
||||
@@ -360,18 +352,6 @@ ConditionVariable::Wait(recursive_lock* lock, uint32 flags, bigtime_t timeout)
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
ConditionVariable::Wait(spinlock* lock, uint32 flags, bigtime_t timeout)
|
||||
{
|
||||
ConditionVariableEntry entry;
|
||||
Add(&entry);
|
||||
release_spinlock(lock);
|
||||
status_t res = entry.Wait(flags, timeout);
|
||||
acquire_spinlock(lock);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/*static*/ void
|
||||
ConditionVariable::NotifyOne(const void* object, status_t result)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user