bonefish + axeld:
* Removed the superfluous "flags" parameter from ConditionVariable::Add() that we forgot there when we moved the flags field from ConditionVariableEntry::Add() to Wait(). * Using this method was therefore not a good idea - only UnixFifo did, though. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26454 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
2293ed6941
commit
cb9191556c
@ -35,8 +35,7 @@ public:
|
||||
inline ConditionVariable* Variable() const { return fVariable; }
|
||||
|
||||
private:
|
||||
inline void AddToVariable(ConditionVariable* variable,
|
||||
uint32 flags);
|
||||
inline void AddToVariable(ConditionVariable* variable);
|
||||
|
||||
private:
|
||||
ConditionVariable* fVariable;
|
||||
@ -60,8 +59,7 @@ public:
|
||||
inline void NotifyOne(bool threadsLocked = false);
|
||||
inline void NotifyAll(bool threadsLocked = false);
|
||||
|
||||
void Add(ConditionVariableEntry* entry,
|
||||
uint32 flags = 0);
|
||||
void Add(ConditionVariableEntry* entry);
|
||||
|
||||
const void* Object() const { return fObject; }
|
||||
|
||||
|
@ -447,10 +447,11 @@ UnixFifo::_Read(UnixRequest& request, bigtime_t timeout)
|
||||
while (fReaders.Head() != &request
|
||||
&& !(IsReadShutdown() && fBuffer.Readable() == 0)) {
|
||||
ConditionVariableEntry entry;
|
||||
fReadCondition.Add(&entry, B_CAN_INTERRUPT);
|
||||
fReadCondition.Add(&entry);
|
||||
|
||||
mutex_unlock(&fLock);
|
||||
status_t error = entry.Wait(B_ABSOLUTE_TIMEOUT, timeout);
|
||||
status_t error = entry.Wait(B_ABSOLUTE_TIMEOUT | B_CAN_INTERRUPT,
|
||||
timeout);
|
||||
mutex_lock(&fLock);
|
||||
|
||||
if (error != B_OK)
|
||||
@ -473,10 +474,11 @@ UnixFifo::_Read(UnixRequest& request, bigtime_t timeout)
|
||||
while (fBuffer.Readable() == 0
|
||||
&& !IsReadShutdown() && !IsWriteShutdown()) {
|
||||
ConditionVariableEntry entry;
|
||||
fReadCondition.Add(&entry, B_CAN_INTERRUPT);
|
||||
fReadCondition.Add(&entry);
|
||||
|
||||
mutex_unlock(&fLock);
|
||||
status_t error = entry.Wait(B_ABSOLUTE_TIMEOUT, timeout);
|
||||
status_t error = entry.Wait(B_ABSOLUTE_TIMEOUT | B_CAN_INTERRUPT,
|
||||
timeout);
|
||||
mutex_lock(&fLock);
|
||||
|
||||
if (error != B_OK)
|
||||
@ -503,10 +505,11 @@ UnixFifo::_Write(UnixRequest& request, bigtime_t timeout)
|
||||
// wait for the request to reach the front of the queue
|
||||
while (fWriters.Head() != &request && !IsWriteShutdown()) {
|
||||
ConditionVariableEntry entry;
|
||||
fWriteCondition.Add(&entry, B_CAN_INTERRUPT);
|
||||
fWriteCondition.Add(&entry);
|
||||
|
||||
mutex_unlock(&fLock);
|
||||
status_t error = entry.Wait(B_ABSOLUTE_TIMEOUT, timeout);
|
||||
status_t error = entry.Wait(B_ABSOLUTE_TIMEOUT | B_CAN_INTERRUPT,
|
||||
timeout);
|
||||
mutex_lock(&fLock);
|
||||
|
||||
if (error != B_OK)
|
||||
@ -529,19 +532,19 @@ UnixFifo::_Write(UnixRequest& request, bigtime_t timeout)
|
||||
while (error == B_OK && fBuffer.Writable() == 0 && !IsWriteShutdown()
|
||||
&& !IsReadShutdown()) {
|
||||
ConditionVariableEntry entry;
|
||||
fWriteCondition.Add(&entry, B_CAN_INTERRUPT);
|
||||
|
||||
fWriteCondition.Add(&entry);
|
||||
|
||||
mutex_unlock(&fLock);
|
||||
error = entry.Wait(B_ABSOLUTE_TIMEOUT, timeout);
|
||||
error = entry.Wait(B_ABSOLUTE_TIMEOUT | B_CAN_INTERRUPT, timeout);
|
||||
mutex_lock(&fLock);
|
||||
|
||||
if (error != B_OK)
|
||||
RETURN_ERROR(error);
|
||||
}
|
||||
|
||||
|
||||
if (IsWriteShutdown())
|
||||
RETURN_ERROR(UNIX_FIFO_SHUTDOWN);
|
||||
|
||||
|
||||
if (IsReadShutdown())
|
||||
RETURN_ERROR(EPIPE);
|
||||
|
||||
|
@ -171,17 +171,14 @@ ConditionVariableEntry::Wait(const void* object, uint32 flags,
|
||||
|
||||
|
||||
inline void
|
||||
ConditionVariableEntry::AddToVariable(ConditionVariable* variable, uint32 flags)
|
||||
ConditionVariableEntry::AddToVariable(ConditionVariable* variable)
|
||||
{
|
||||
fThread = thread_get_current_thread();
|
||||
|
||||
thread_prepare_to_block(fThread, flags,
|
||||
THREAD_BLOCK_TYPE_CONDITION_VARIABLE, fVariable);
|
||||
|
||||
// add to the variable
|
||||
InterruptsSpinLocker _(sConditionVariablesLock);
|
||||
|
||||
fVariable = variable;
|
||||
fWaitStatus = STATUS_ADDED;
|
||||
fVariable->fEntries.Add(this);
|
||||
}
|
||||
|
||||
@ -246,9 +243,9 @@ ConditionVariable::Unpublish(bool threadsLocked)
|
||||
|
||||
|
||||
void
|
||||
ConditionVariable::Add(ConditionVariableEntry* entry, uint32 flags)
|
||||
ConditionVariable::Add(ConditionVariableEntry* entry)
|
||||
{
|
||||
entry->AddToVariable(this, flags);
|
||||
entry->AddToVariable(this);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user