code simplification for last commit

fstore_storage_engine
YuQing 2023-02-23 10:51:46 +08:00
parent 92fbcab0f4
commit 8bedbb6f27
1 changed files with 18 additions and 43 deletions

View File

@ -425,30 +425,6 @@ void sf_recv_notify_read(int sock, short event, void *arg)
__LINE__, sock, errno, STRERROR(errno));
}
if (SF_G_EPOLL_EDGE_TRIGGER) {
while (1) {
PTHREAD_MUTEX_LOCK(&thread_data->waiting_queue.lock);
if (thread_data->waiting_queue.head != NULL) {
task = thread_data->waiting_queue.head;
thread_data->waiting_queue.head = task->notify_next;
if (thread_data->waiting_queue.head == NULL) {
thread_data->waiting_queue.tail = NULL;
}
} else {
task = NULL;
}
PTHREAD_MUTEX_UNLOCK(&thread_data->waiting_queue.lock);
if (task != NULL) {
stage = FC_ATOMIC_GET(task->nio_stages.notify);
__sync_bool_compare_and_swap(&task->nio_stages.notify,
stage, SF_NIO_STAGE_NONE);
deal_notified_task(task, stage);
} else {
break;
}
}
} else {
PTHREAD_MUTEX_LOCK(&thread_data->waiting_queue.lock);
current = thread_data->waiting_queue.head;
thread_data->waiting_queue.head = NULL;
@ -460,7 +436,7 @@ void sf_recv_notify_read(int sock, short event, void *arg)
current = current->notify_next;
stage = FC_ATOMIC_GET(task->nio_stages.notify);
if (stage == SF_NIO_STAGE_CONTINUE) {
if (stage == SF_NIO_STAGE_CONTINUE || SF_G_EPOLL_EDGE_TRIGGER) {
/* MUST set to SF_NIO_STAGE_NONE first for re-entry */
__sync_bool_compare_and_swap(&task->nio_stages.notify,
stage, SF_NIO_STAGE_NONE);
@ -471,7 +447,6 @@ void sf_recv_notify_read(int sock, short event, void *arg)
stage, SF_NIO_STAGE_NONE);
}
}
}
}
int sf_send_add_event(struct fast_task_info *task)