From 63c994a1d4471627447ea1dfb23f90464dc07391 Mon Sep 17 00:00:00 2001 From: zhengshuxin Date: Sun, 3 Jul 2022 23:49:44 +0800 Subject: [PATCH] test fiber event in multiple threads mode --- lib_fiber/c/src/fbase_event.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib_fiber/c/src/fbase_event.c b/lib_fiber/c/src/fbase_event.c index dc09c5e3b..7d87b73db 100644 --- a/lib_fiber/c/src/fbase_event.c +++ b/lib_fiber/c/src/fbase_event.c @@ -83,6 +83,11 @@ int fbase_event_wait(FIBER_BASE *fbase) } while (1) { + if (acl_fiber_scheduled() && read_wait(fbase->event_in, -1) == -1) { + msg_error("%s(%d), %s: read_wait error, fd=%d", + __FILE__, __LINE__, __FUNCTION__, fbase->event_in); + return -1; + } #ifdef SYS_WIN ret = (int) acl_fiber_recv(fbase->event_in, (char*) &n, sizeof(n), 0); #else @@ -107,8 +112,9 @@ int fbase_event_wait(FIBER_BASE *fbase) interrupt, (int) fbase->event_in, ret); doze(1); } else if (err == FIBER_EAGAIN) { - msg_info("%s(%d), %s: read EAGAIN, in=%d, ret=%d", - __FILE__, __LINE__, __FUNCTION__, + msg_info("%s(%d), %s: scheduled %s, read EAGAIN, " + "in=%d, ret=%d", __FILE__, __LINE__, + __FUNCTION__, acl_fiber_scheduled() ? "yes":"no", (int) fbase->event_in, ret); doze(1); } else {