axeld + bonefish:
Changed condition variables so that it is allowed to block (e.g. lock mutexes etc.) between Add() and Wait(). This fixes #2059, since the block writer used them this way and could thusly fail to wait for a condition variable, causing a temporary stack object to be used past its lifetime. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25525 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -358,13 +358,13 @@ Inode::WriteDataToBuffer(const void *_data, size_t *_length, bool nonBlocking)
|
||||
return B_WOULD_BLOCK;
|
||||
|
||||
ConditionVariableEntry entry;
|
||||
entry.Add(this, B_CAN_INTERRUPT);
|
||||
entry.Add(this);
|
||||
|
||||
WriteRequest request(minToWrite);
|
||||
fWriteRequests.Add(&request);
|
||||
|
||||
mutex_unlock(&fRequestLock);
|
||||
status_t status = entry.Wait();
|
||||
status_t status = entry.Wait(B_CAN_INTERRUPT);
|
||||
mutex_lock(&fRequestLock);
|
||||
|
||||
fWriteRequests.Remove(&request);
|
||||
|
||||
Reference in New Issue
Block a user