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
|
// wait if it's busy
|
||||||
while (daemon->executing) {
|
while (daemon->executing) {
|
||||||
fUnregisterWaiters++;
|
fUnregisterWaiters++;
|
||||||
|
fUnregisterCondition.Wait(locker.Get());
|
||||||
ConditionVariableEntry entry;
|
|
||||||
fUnregisterCondition.Add(&entry);
|
|
||||||
|
|
||||||
locker.Unlock();
|
|
||||||
|
|
||||||
entry.Wait();
|
|
||||||
|
|
||||||
locker.Lock();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,13 +111,8 @@ user_mutex_wait_locked(int32* mutex, addr_t physicalAddress, const char* name,
|
|||||||
add_user_mutex_entry(&entry);
|
add_user_mutex_entry(&entry);
|
||||||
|
|
||||||
// wait
|
// wait
|
||||||
ConditionVariableEntry waitEntry;
|
|
||||||
entry.condition.Init((void*)physicalAddress, "user mutex");
|
entry.condition.Init((void*)physicalAddress, "user mutex");
|
||||||
entry.condition.Add(&waitEntry);
|
status_t error = entry.condition.Wait(locker.Get(), flags, timeout);
|
||||||
|
|
||||||
locker.Unlock();
|
|
||||||
status_t error = waitEntry.Wait(flags, timeout);
|
|
||||||
locker.Lock();
|
|
||||||
|
|
||||||
if (error != B_OK && entry.locked)
|
if (error != B_OK && entry.locked)
|
||||||
error = B_OK;
|
error = B_OK;
|
||||||
|
@ -983,12 +983,7 @@ MemoryManager::_AllocateChunks(size_t chunkSize, uint32 chunkCount,
|
|||||||
} else
|
} else
|
||||||
break;
|
break;
|
||||||
|
|
||||||
ConditionVariableEntry entry;
|
allocationEntry->condition.Wait(&sLock);
|
||||||
allocationEntry->condition.Add(&entry);
|
|
||||||
|
|
||||||
mutex_unlock(&sLock);
|
|
||||||
entry.Wait();
|
|
||||||
mutex_lock(&sLock);
|
|
||||||
|
|
||||||
if (_GetChunks(metaChunkList, chunkSize, chunkCount, _metaChunk,
|
if (_GetChunks(metaChunkList, chunkSize, chunkCount, _metaChunk,
|
||||||
_chunk)) {
|
_chunk)) {
|
||||||
|
@ -920,12 +920,7 @@ object_cache_reserve_internal(ObjectCache* cache, size_t objectCount,
|
|||||||
} else
|
} else
|
||||||
break;
|
break;
|
||||||
|
|
||||||
ConditionVariableEntry entry;
|
resizeEntry->condition.Wait(&cache->lock);
|
||||||
resizeEntry->condition.Add(&entry);
|
|
||||||
|
|
||||||
cache->Unlock();
|
|
||||||
entry.Wait();
|
|
||||||
cache->Lock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// prepare the resize entry others can wait on
|
// prepare the resize entry others can wait on
|
||||||
@ -1072,11 +1067,7 @@ object_cache_maintainer(void*)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConditionVariableEntry entry;
|
sMaintenanceCondition.Wait(locker.Get());
|
||||||
sMaintenanceCondition.Add(&entry);
|
|
||||||
locker.Unlock();
|
|
||||||
entry.Wait();
|
|
||||||
locker.Lock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectCache* cache = sMaintenanceQueue.RemoveHead();
|
ObjectCache* cache = sMaintenanceQueue.RemoveHead();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user