mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 11:57:34 +00:00
Kernel: Fix race conditions processing async device requests
This commit is contained in:
parent
8177f2474b
commit
5ccc3637e3
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