struct fast_task_info add field: nio_stages.next for epoll edge trigger

remotes/origin/fstore_storage_engine
YuQing 2023-02-12 10:30:42 +08:00
parent 73ab695fc8
commit c5138cc7cf
3 changed files with 14 additions and 7 deletions

View File

@ -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

View File

@ -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

View File

@ -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;