kernel: Make use of the new ConditionVariable lock-switching APIs in a few places.
This commit is contained in:
parent
8af7b72d8d
commit
8f68daed84
@ -122,15 +122,7 @@ KernelDaemon::Unregister(daemon_hook function, void* arg)
|
||||
// wait if it's busy
|
||||
while (daemon->executing) {
|
||||
fUnregisterWaiters++;
|
||||
|
||||
ConditionVariableEntry entry;
|
||||
fUnregisterCondition.Add(&entry);
|
||||
|
||||
locker.Unlock();
|
||||
|
||||
entry.Wait();
|
||||
|
||||
locker.Lock();
|
||||
fUnregisterCondition.Wait(locker.Get());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,13 +111,8 @@ user_mutex_wait_locked(int32* mutex, addr_t physicalAddress, const char* name,
|
||||
add_user_mutex_entry(&entry);
|
||||
|
||||
// wait
|
||||
ConditionVariableEntry waitEntry;
|
||||
entry.condition.Init((void*)physicalAddress, "user mutex");
|
||||
entry.condition.Add(&waitEntry);
|
||||
|
||||
locker.Unlock();
|
||||
status_t error = waitEntry.Wait(flags, timeout);
|
||||
locker.Lock();
|
||||
status_t error = entry.condition.Wait(locker.Get(), flags, timeout);
|
||||
|
||||
if (error != B_OK && entry.locked)
|
||||
error = B_OK;
|
||||
|
@ -983,12 +983,7 @@ MemoryManager::_AllocateChunks(size_t chunkSize, uint32 chunkCount,
|
||||
} else
|
||||
break;
|
||||
|
||||
ConditionVariableEntry entry;
|
||||
allocationEntry->condition.Add(&entry);
|
||||
|
||||
mutex_unlock(&sLock);
|
||||
entry.Wait();
|
||||
mutex_lock(&sLock);
|
||||
allocationEntry->condition.Wait(&sLock);
|
||||
|
||||
if (_GetChunks(metaChunkList, chunkSize, chunkCount, _metaChunk,
|
||||
_chunk)) {
|
||||
|
@ -920,12 +920,7 @@ object_cache_reserve_internal(ObjectCache* cache, size_t objectCount,
|
||||
} else
|
||||
break;
|
||||
|
||||
ConditionVariableEntry entry;
|
||||
resizeEntry->condition.Add(&entry);
|
||||
|
||||
cache->Unlock();
|
||||
entry.Wait();
|
||||
cache->Lock();
|
||||
resizeEntry->condition.Wait(&cache->lock);
|
||||
}
|
||||
|
||||
// prepare the resize entry others can wait on
|
||||
@ -1072,11 +1067,7 @@ object_cache_maintainer(void*)
|
||||
continue;
|
||||
}
|
||||
|
||||
ConditionVariableEntry entry;
|
||||
sMaintenanceCondition.Add(&entry);
|
||||
locker.Unlock();
|
||||
entry.Wait();
|
||||
locker.Lock();
|
||||
sMaintenanceCondition.Wait(locker.Get());
|
||||
}
|
||||
|
||||
ObjectCache* cache = sMaintenanceQueue.RemoveHead();
|
||||
|
Loading…
x
Reference in New Issue
Block a user