Skip to content

Commit 63c994a

Browse files
zhengshuxinzhengshuxin
authored andcommitted
test fiber event in multiple threads mode
1 parent 745e80a commit 63c994a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib_fiber/c/src/fbase_event.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ int fbase_event_wait(FIBER_BASE *fbase)
8383
}
8484

8585
while (1) {
86+
if (acl_fiber_scheduled() && read_wait(fbase->event_in, -1) == -1) {
87+
msg_error("%s(%d), %s: read_wait error, fd=%d",
88+
__FILE__, __LINE__, __FUNCTION__, fbase->event_in);
89+
return -1;
90+
}
8691
#ifdef SYS_WIN
8792
ret = (int) acl_fiber_recv(fbase->event_in, (char*) &n, sizeof(n), 0);
8893
#else
@@ -107,8 +112,9 @@ int fbase_event_wait(FIBER_BASE *fbase)
107112
interrupt, (int) fbase->event_in, ret);
108113
doze(1);
109114
} else if (err == FIBER_EAGAIN) {
110-
msg_info("%s(%d), %s: read EAGAIN, in=%d, ret=%d",
111-
__FILE__, __LINE__, __FUNCTION__,
115+
msg_info("%s(%d), %s: scheduled %s, read EAGAIN, "
116+
"in=%d, ret=%d", __FILE__, __LINE__,
117+
__FUNCTION__, acl_fiber_scheduled() ? "yes":"no",
112118
(int) fbase->event_in, ret);
113119
doze(1);
114120
} else {

0 commit comments

Comments
 (0)