diff --git a/HISTORY b/HISTORY index 10b2626..cbeed63 100644 --- a/HISTORY +++ b/HISTORY @@ -1,4 +1,7 @@ +Version 1.66 2023-02-12 + * struct fast_task_info add field: nio_stages.next for epoll edge trigger + Version 1.65 2023-01-09 * locked_list.h: add functions locked_list_move and locked_list_move_tail * add function tcp_socket_connected diff --git a/src/fast_task_queue.h b/src/fast_task_queue.h index f74d336..57250de 100644 --- a/src/fast_task_queue.h +++ b/src/fast_task_queue.h @@ -100,13 +100,14 @@ struct fast_task_info struct { uint8_t current; volatile uint8_t notify; + volatile uint8_t next; } nio_stages; //stages for network IO - TaskContinueCallback continue_callback; //for continue stage volatile int8_t reffer_count; volatile int8_t canceled; //if task canceled short connect_timeout; //for client side short network_timeout; int64_t req_count; //request count + TaskContinueCallback continue_callback; //for continue stage TaskFinishCallback finish_callback; struct nio_thread_data *thread_data; void *ctx; //context pointer for libserverframe nio diff --git a/src/ioevent_loop.c b/src/ioevent_loop.c index ce0ee19..83fe22d 100644 --- a/src/ioevent_loop.c +++ b/src/ioevent_loop.c @@ -100,23 +100,26 @@ int ioevent_loop(struct nio_thread_data *pThreadData, FastTimerEntry head; struct fast_task_info *task; time_t last_check_time; + int save_extra_events; int count; memset(&ev_notify, 0, sizeof(ev_notify)); ev_notify.event.fd = FC_NOTIFY_READ_FD(pThreadData); ev_notify.event.callback = recv_notify_callback; ev_notify.thread_data = pThreadData; - if (ioevent_attach(&pThreadData->ev_puller, - pThreadData->pipe_fds[0], IOEVENT_READ, - &ev_notify) != 0) + + save_extra_events = pThreadData->ev_puller.extra_events; + pThreadData->ev_puller.extra_events = 0; //disable edge trigger temporarily + if (ioevent_attach(&pThreadData->ev_puller, ev_notify. + event.fd, IOEVENT_READ, &ev_notify) != 0) { result = errno != 0 ? errno : ENOMEM; - logCrit("file: "__FILE__", line: %d, " \ - "ioevent_attach fail, " \ - "errno: %d, error info: %s", \ + logCrit("file: "__FILE__", line: %d, " + "ioevent_attach fail, errno: %d, error info: %s", __LINE__, result, STRERROR(result)); return result; } + pThreadData->ev_puller.extra_events = save_extra_events; //restore pThreadData->deleted_list = NULL; last_check_time = g_current_time;