提交 1ac8c8f3 编写于 作者: Y YuQing

fast_task_info add fields: reffer_count and continue_callback

上级 d54007f7
Version 1.44 2020-10-21
Version 1.44 2020-10-28
* add test file src/tests/test_pthread_lock.c
* add uniq_skiplist.[hc]
* add function split_string_ex
......
......@@ -87,7 +87,9 @@ struct fast_task_info
uint8_t current;
volatile uint8_t notify;
} nio_stages; //stages for network IO
bool canceled; //if task canceled
int (*continue_callback)(struct fast_task_info *task); //for continue stage
volatile int8_t reffer_count;
volatile int8_t canceled; //if task canceled
int connect_timeout; //for client side
int network_timeout;
int64_t req_count; //request count
......
......@@ -32,20 +32,16 @@ int ioevent_remove(IOEventPoller *ioevent, void *data);
int ioevent_set(struct fast_task_info *pTask, struct nio_thread_data *pThread,
int sock, short event, IOEventCallback callback, const int timeout);
//only called by the nio thread
static inline void ioevent_add_to_deleted_list(struct fast_task_info *task)
{
if (task->thread_data == NULL)
if (!__sync_bool_compare_and_swap(&task->canceled, 0, 1))
{
return;
}
if (task->canceled) {
logError("file: "__FILE__", line: %d, "
logWarning("file: "__FILE__", line: %d, "
"task %p already canceled", __LINE__, task);
return;
}
task->canceled = true;
task->next = task->thread_data->deleted_list;
task->thread_data->deleted_list = task;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册