function ioevent_reset impl. for RDMA
parent
f49c5d134a
commit
b4e5a26ba0
|
|
@ -201,14 +201,13 @@ int ioevent_set(struct fast_task_info *task, struct nio_thread_data *pThread,
|
||||||
task->thread_data = pThread;
|
task->thread_data = pThread;
|
||||||
task->event.fd = sock;
|
task->event.fd = sock;
|
||||||
task->event.callback = callback;
|
task->event.callback = callback;
|
||||||
if (ioevent_attach(&pThread->ev_puller,
|
if (ioevent_attach(&pThread->ev_puller, sock, event, task) < 0)
|
||||||
sock, event, task) < 0)
|
|
||||||
{
|
{
|
||||||
result = errno != 0 ? errno : ENOENT;
|
result = errno != 0 ? errno : ENOENT;
|
||||||
logError("file: "__FILE__", line: %d, " \
|
logError("file: "__FILE__", line: %d, "
|
||||||
"ioevent_attach fail, " \
|
"ioevent_attach fail, fd: %d, "
|
||||||
"errno: %d, error info: %s", \
|
"errno: %d, error info: %s",
|
||||||
__LINE__, result, STRERROR(result));
|
__LINE__, sock, result, STRERROR(result));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -216,3 +215,19 @@ int ioevent_set(struct fast_task_info *task, struct nio_thread_data *pThread,
|
||||||
fast_timer_add(&pThread->timer, &task->event.timer);
|
fast_timer_add(&pThread->timer, &task->event.timer);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ioevent_reset(struct fast_task_info *task, int new_fd, short event)
|
||||||
|
{
|
||||||
|
if (task->event.fd == new_fd)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (task->event.fd >= 0)
|
||||||
|
{
|
||||||
|
ioevent_detach(&task->thread_data->ev_puller, task->event.fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
task->event.fd = new_fd;
|
||||||
|
return ioevent_attach(&task->thread_data->ev_puller, new_fd, event, task);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,8 @@ int ioevent_remove(IOEventPoller *ioevent, void *data);
|
||||||
int ioevent_set(struct fast_task_info *pTask, struct nio_thread_data *pThread,
|
int ioevent_set(struct fast_task_info *pTask, struct nio_thread_data *pThread,
|
||||||
int sock, short event, IOEventCallback callback, const int timeout);
|
int sock, short event, IOEventCallback callback, const int timeout);
|
||||||
|
|
||||||
|
int ioevent_reset(struct fast_task_info *task, int new_fd, short event);
|
||||||
|
|
||||||
static inline bool ioevent_is_canceled(struct fast_task_info *task)
|
static inline bool ioevent_is_canceled(struct fast_task_info *task)
|
||||||
{
|
{
|
||||||
return __sync_fetch_and_add(&task->canceled, 0) != 0;
|
return __sync_fetch_and_add(&task->canceled, 0) != 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue