mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-04 08:36:12 +00:00
Kernel: Fix race conditions processing async device requests
This commit is contained in:
parent
8177f2474b
commit
5ccc3637e3
Notes:
sideshowbarker
2024-07-18 21:20:56 +09:00
Author: https://github.com/tomuta
Commit: 5ccc3637e3
Pull-request: https://github.com/SerenityOS/serenity/pull/5796
4 changed files with 23 additions and 41 deletions
|
@ -72,14 +72,11 @@ public:
|
|||
NonnullRefPtr<AsyncRequestType> make_request(Args&&... args)
|
||||
{
|
||||
auto request = adopt(*new AsyncRequestType(*this, forward<Args>(args)...));
|
||||
bool was_empty;
|
||||
{
|
||||
ScopedSpinLock lock(m_requests_lock);
|
||||
was_empty = m_requests.is_empty();
|
||||
m_requests.append(request);
|
||||
}
|
||||
ScopedSpinLock lock(m_requests_lock);
|
||||
bool was_empty = m_requests.is_empty();
|
||||
m_requests.append(request);
|
||||
if (was_empty)
|
||||
request->do_start({});
|
||||
request->do_start(move(lock));
|
||||
return request;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue