CoroHandle handle,
CoroResume resume) {
auto execute = [handle, resume]() { (*resume)(handle); };
+ std::unique_lock<std::mutex> lock(token->mu);
if (token->ready) {
+ lock.unlock();
execute();
} else {
- std::unique_lock<std::mutex> lock(token->mu);
token->awaiters.push_back([execute]() { execute(); });
}
}
CoroHandle handle,
CoroResume resume) {
auto execute = [handle, resume]() { (*resume)(handle); };
+ std::unique_lock<std::mutex> lock(value->mu);
if (value->ready) {
+ lock.unlock();
execute();
} else {
- std::unique_lock<std::mutex> lock(value->mu);
value->awaiters.push_back([execute]() { execute(); });
}
}
CoroHandle handle,
CoroResume resume) {
auto execute = [handle, resume]() { (*resume)(handle); };
+ std::unique_lock<std::mutex> lock(group->mu);
if (group->pendingTokens == 0) {
+ lock.unlock();
execute();
} else {
- std::unique_lock<std::mutex> lock(group->mu);
group->awaiters.push_back([execute]() { execute(); });
}
}