struct fast_task_info add field: nio_stages.next for epoll edge trigger
parent
73ab695fc8
commit
c5138cc7cf
3
HISTORY
3
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
|
Version 1.65 2023-01-09
|
||||||
* locked_list.h: add functions locked_list_move and locked_list_move_tail
|
* locked_list.h: add functions locked_list_move and locked_list_move_tail
|
||||||
* add function tcp_socket_connected
|
* add function tcp_socket_connected
|
||||||
|
|
|
||||||
|
|
@ -100,13 +100,14 @@ struct fast_task_info
|
||||||
struct {
|
struct {
|
||||||
uint8_t current;
|
uint8_t current;
|
||||||
volatile uint8_t notify;
|
volatile uint8_t notify;
|
||||||
|
volatile uint8_t next;
|
||||||
} nio_stages; //stages for network IO
|
} nio_stages; //stages for network IO
|
||||||
TaskContinueCallback continue_callback; //for continue stage
|
|
||||||
volatile int8_t reffer_count;
|
volatile int8_t reffer_count;
|
||||||
volatile int8_t canceled; //if task canceled
|
volatile int8_t canceled; //if task canceled
|
||||||
short connect_timeout; //for client side
|
short connect_timeout; //for client side
|
||||||
short network_timeout;
|
short network_timeout;
|
||||||
int64_t req_count; //request count
|
int64_t req_count; //request count
|
||||||
|
TaskContinueCallback continue_callback; //for continue stage
|
||||||
TaskFinishCallback finish_callback;
|
TaskFinishCallback finish_callback;
|
||||||
struct nio_thread_data *thread_data;
|
struct nio_thread_data *thread_data;
|
||||||
void *ctx; //context pointer for libserverframe nio
|
void *ctx; //context pointer for libserverframe nio
|
||||||
|
|
|
||||||
|
|
@ -100,23 +100,26 @@ int ioevent_loop(struct nio_thread_data *pThreadData,
|
||||||
FastTimerEntry head;
|
FastTimerEntry head;
|
||||||
struct fast_task_info *task;
|
struct fast_task_info *task;
|
||||||
time_t last_check_time;
|
time_t last_check_time;
|
||||||
|
int save_extra_events;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
memset(&ev_notify, 0, sizeof(ev_notify));
|
memset(&ev_notify, 0, sizeof(ev_notify));
|
||||||
ev_notify.event.fd = FC_NOTIFY_READ_FD(pThreadData);
|
ev_notify.event.fd = FC_NOTIFY_READ_FD(pThreadData);
|
||||||
ev_notify.event.callback = recv_notify_callback;
|
ev_notify.event.callback = recv_notify_callback;
|
||||||
ev_notify.thread_data = pThreadData;
|
ev_notify.thread_data = pThreadData;
|
||||||
if (ioevent_attach(&pThreadData->ev_puller,
|
|
||||||
pThreadData->pipe_fds[0], IOEVENT_READ,
|
save_extra_events = pThreadData->ev_puller.extra_events;
|
||||||
&ev_notify) != 0)
|
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;
|
result = errno != 0 ? errno : ENOMEM;
|
||||||
logCrit("file: "__FILE__", line: %d, " \
|
logCrit("file: "__FILE__", line: %d, "
|
||||||
"ioevent_attach fail, " \
|
"ioevent_attach fail, errno: %d, error info: %s",
|
||||||
"errno: %d, error info: %s", \
|
|
||||||
__LINE__, result, STRERROR(result));
|
__LINE__, result, STRERROR(result));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
pThreadData->ev_puller.extra_events = save_extra_events; //restore
|
||||||
|
|
||||||
pThreadData->deleted_list = NULL;
|
pThreadData->deleted_list = NULL;
|
||||||
last_check_time = g_current_time;
|
last_check_time = g_current_time;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue