mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-11-29 18:37:41 +08:00
make wakeup_waiter more safety when timeout.
This commit is contained in:
parent
369b7b1038
commit
904dfc103f
@ -72,11 +72,13 @@ static void wakeup_waiter(SYNC_TIMER *timer UNUSED, SYNC_OBJ *obj)
|
||||
// The fiber must has been awakened by the other fiber or thread.
|
||||
|
||||
if (obj->delay < 0) {
|
||||
// No timer has been set if delay < 0,
|
||||
// No timer has been set if delay < 0,
|
||||
ring_detach(&obj->fb->me); // Safety detatch me from others.
|
||||
acl_fiber_ready(obj->fb);
|
||||
} else if (fiber_timer_del(obj->fb) == 1) {
|
||||
// Wakeup the waiting fiber before the timer arrives,
|
||||
// just remove it from the timer.
|
||||
ring_detach(&obj->fb->me); // Safety detatch me from others.
|
||||
acl_fiber_ready(obj->fb);
|
||||
}
|
||||
// else: The fiber has been awakened by the timer.
|
||||
|
Loading…
Reference in New Issue
Block a user