Skip to content
Snippets Groups Projects
Commit 2379771f authored by Dor Laor's avatar Dor Laor
Browse files

Use wake_with scheme in order not to wake w/ the lock held

This way it's possible to wake a thread while holding the lock
that protects the thread pointer of going away. The lock itself
won't be held by the waker and thus the wakee will be able to
use it immedietly w/o ctx. Suggested by Nadav.
parent 2fc78575
No related branches found
No related tags found
No related merge requests found
......@@ -175,9 +175,10 @@ void virtio_blk::response_worker() {
// wake up the requesting thread in case the ring was full before
_request_thread_lock.lock();
if (_waiting_request_thread) {
_waiting_request_thread->wake();
_waiting_request_thread->wake_with([&] { _request_thread_lock.unlock(); });
} else {
_request_thread_lock.unlock();
}
_request_thread_lock.unlock();
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment