add func sf_nio_add_to_deleted_list
parent
8824c35975
commit
dfc58be3ec
11
src/sf_nio.h
11
src/sf_nio.h
|
|
@ -22,6 +22,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "fastcommon/fast_task_queue.h"
|
||||
#include "fastcommon/ioevent_loop.h"
|
||||
#include "sf_define.h"
|
||||
#include "sf_types.h"
|
||||
|
||||
|
|
@ -99,6 +100,16 @@ static inline bool sf_client_sock_in_read_stage(struct fast_task_info *task)
|
|||
return (task->event.callback == (IOEventCallback)sf_client_sock_read);
|
||||
}
|
||||
|
||||
static inline void sf_nio_add_to_deleted_list(struct nio_thread_data
|
||||
*thread_data, struct fast_task_info *task)
|
||||
{
|
||||
if (task->thread_data == thread_data) {
|
||||
ioevent_add_to_deleted_list(task);
|
||||
} else {
|
||||
sf_nio_notify(task, SF_NIO_STAGE_CLOSE);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -204,11 +204,14 @@ int sf_service_init_ex2(SFContext *sf_context, const char *name,
|
|||
return result;
|
||||
}
|
||||
|
||||
if ((result=init_pthread_lock(&thread_data->waiting_queue.lock)) != 0) {
|
||||
if ((result=init_pthread_lock(&thread_data->
|
||||
waiting_queue.lock)) != 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
#if defined(OS_LINUX)
|
||||
FC_NOTIFY_READ_FD(thread_data) = eventfd(0, EFD_NONBLOCK);
|
||||
FC_NOTIFY_READ_FD(thread_data) = eventfd(0,
|
||||
EFD_NONBLOCK | EFD_CLOEXEC);
|
||||
if (FC_NOTIFY_READ_FD(thread_data) < 0) {
|
||||
result = errno != 0 ? errno : EPERM;
|
||||
logError("file: "__FILE__", line: %d, "
|
||||
|
|
@ -228,10 +231,11 @@ int sf_service_init_ex2(SFContext *sf_context, const char *name,
|
|||
break;
|
||||
}
|
||||
if ((result=fd_add_flags(FC_NOTIFY_READ_FD(thread_data),
|
||||
O_NONBLOCK)) != 0)
|
||||
O_NONBLOCK | FD_CLOEXEC)) != 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
fd_set_cloexec(FC_NOTIFY_WRITE_FD(thread_data));
|
||||
#endif
|
||||
|
||||
thread_ctx->sf_context = sf_context;
|
||||
|
|
|
|||
Loading…
Reference in New Issue