mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-12-01 19:37:45 +08:00
Test and optimize.
This commit is contained in:
parent
5d1f8f995e
commit
6b973b55a1
@ -256,7 +256,6 @@ static void fiber_io_loop(ACL_FIBER *self fiber_unused, void *ctx)
|
||||
left = -1;
|
||||
} else {
|
||||
now = event_get_stamp(__thread_fiber->event);
|
||||
last = now;
|
||||
if (now >= timer->expire) {
|
||||
left = 0;
|
||||
} else {
|
||||
@ -303,6 +302,7 @@ static void fiber_io_loop(ACL_FIBER *self fiber_unused, void *ctx)
|
||||
now = event_get_stamp(__thread_fiber->event);
|
||||
if (now - last >= left) {
|
||||
wakeup_timers(__thread_fiber->ev_timer, now);
|
||||
last = now;
|
||||
}
|
||||
|
||||
if (timer_cache_size(__thread_fiber->ev_timer) == 0) {
|
||||
@ -595,7 +595,7 @@ int fiber_wait_read(FILE_EVENT *fe)
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
// else: the IO read event should has been removed in read_callback.
|
||||
// else: the IO read event should have been removed in read_callback.
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
static void client_echo(const acl::shared_stream& conn, bool readable) {
|
||||
acl::string buf;
|
||||
conn->set_rw_timeout(1, true);
|
||||
|
||||
while (true) {
|
||||
if (readable) {
|
||||
struct timeval begin{}, end{};
|
||||
@ -31,7 +33,11 @@ static void client_echo(const acl::shared_stream& conn, bool readable) {
|
||||
printf("client write error %s\r\n", acl::last_serror());
|
||||
break;
|
||||
}
|
||||
//acl::fiber::delay(1000);
|
||||
|
||||
time_t begin = time(NULL);
|
||||
acl::fiber::delay(4000);
|
||||
time_t end = time(NULL);
|
||||
printf(">>>>>>>>>wakeup now, tc=%ld seconds<<<<<<<<\n", end - begin);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user