bugfixed: task_cleanup_func

connection_manager
YuQing 2020-03-10 21:11:30 +08:00
parent 01d24d4838
commit 46dfd4ad01
3 changed files with 7 additions and 10 deletions

View File

@ -223,13 +223,13 @@ int sf_nio_notify(struct fast_task_info *task, const int stage)
if (notify) {
n = 1;
if (write(NOTIFY_WRITE_FD(task->thread_data),
if (write(FC_NOTIFY_WRITE_FD(task->thread_data),
&n, sizeof(n)) != sizeof(n))
{
result = errno != 0 ? errno : EIO;
logError("file: "__FILE__", line: %d, "
"write eventfd %d fail, errno: %d, error info: %s",
__LINE__, NOTIFY_WRITE_FD(task->thread_data),
__LINE__, FC_NOTIFY_WRITE_FD(task->thread_data),
result, STRERROR(result));
return result;
}

View File

@ -10,9 +10,6 @@
#include "sf_define.h"
#include "sf_types.h"
#define NOTIFY_READ_FD(tdata) (tdata)->pipe_fds[0]
#define NOTIFY_WRITE_FD(tdata) (tdata)->pipe_fds[1]
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -180,8 +180,8 @@ int sf_service_init_ex(SFContext *sf_context,
return result;
}
#if defined(OS_LINUX)
NOTIFY_READ_FD(thread_data) = eventfd(0, EFD_NONBLOCK);
if (NOTIFY_READ_FD(thread_data) < 0) {
FC_NOTIFY_READ_FD(thread_data) = eventfd(0, EFD_NONBLOCK);
if (FC_NOTIFY_READ_FD(thread_data) < 0) {
result = errno != 0 ? errno : EPERM;
logError("file: "__FILE__", line: %d, "
"call eventfd fail, "
@ -189,7 +189,7 @@ int sf_service_init_ex(SFContext *sf_context,
__LINE__, result, strerror(result));
break;
}
NOTIFY_WRITE_FD(thread_data) = NOTIFY_READ_FD(thread_data);
FC_NOTIFY_WRITE_FD(thread_data) = FC_NOTIFY_READ_FD(thread_data);
#else
if (pipe(thread_data->pipe_fds) != 0) {
result = errno != 0 ? errno : EPERM;
@ -199,7 +199,7 @@ int sf_service_init_ex(SFContext *sf_context,
__LINE__, result, strerror(result));
break;
}
if ((result=fd_add_flags(NOTIFY_READ_FD(thread_data),
if ((result=fd_add_flags(FC_NOTIFY_READ_FD(thread_data),
O_NONBLOCK)) != 0)
{
break;
@ -249,7 +249,7 @@ static void *worker_thread_entrance(void *arg)
ioevent_loop(thread_ctx->thread_data,
sf_recv_notify_read,
sf_get_task_cleanup_func(),
thread_ctx->sf_context->task_cleanup_func,
&g_sf_global_vars.continue_flag);
ioevent_destroy(&thread_ctx->thread_data->ev_puller);