perf: avoid taking mutex on already-resolved promises (#6984)
This commit is contained in:
parent
ac9708051a
commit
1248a55d32
1 changed files with 4 additions and 0 deletions
|
|
@ -842,6 +842,10 @@ public:
|
|||
}
|
||||
|
||||
void resolve(lean_task_object * t, object * v) {
|
||||
if (t->m_value) {
|
||||
dec(v);
|
||||
return;
|
||||
}
|
||||
unique_lock<mutex> lock(m_mutex);
|
||||
if (t->m_value) {
|
||||
lock.unlock(); // `dec(v)` could lead to `deactivate_task` trying to take the lock
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue