Skip to content

Commit

Permalink
usleep returns ESTOP when schedule timer failed
Browse files Browse the repository at this point in the history
  • Loading branch information
chenBright committed Oct 31, 2023
1 parent 761b399 commit 9ba4c08
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/bthread/task_group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,11 @@ int TaskGroup::usleep(TaskGroup** pg, uint64_t timeout_us) {
g->set_remained(_add_sleep_event, &e);
sched(pg);
g = *pg;
if (e.meta->current_sleep == 0) {
// // Fail to `_add_sleep_event'.
errno = ESTOP;
return -1;
}
e.meta->current_sleep = 0;
if (e.meta->interrupted) {
// Race with set and may consume multiple interruptions, which are OK.
Expand Down

0 comments on commit 9ba4c08

Please sign in to comment.