fast_task_info add fields: reffer_count and continue_callback
parent
d54007f79b
commit
1ac8c8f3c2
2
HISTORY
2
HISTORY
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
Version 1.44 2020-10-21
|
Version 1.44 2020-10-28
|
||||||
* add test file src/tests/test_pthread_lock.c
|
* add test file src/tests/test_pthread_lock.c
|
||||||
* add uniq_skiplist.[hc]
|
* add uniq_skiplist.[hc]
|
||||||
* add function split_string_ex
|
* add function split_string_ex
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,9 @@ struct fast_task_info
|
||||||
uint8_t current;
|
uint8_t current;
|
||||||
volatile uint8_t notify;
|
volatile uint8_t notify;
|
||||||
} nio_stages; //stages for network IO
|
} 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 connect_timeout; //for client side
|
||||||
int network_timeout;
|
int network_timeout;
|
||||||
int64_t req_count; //request count
|
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 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);
|
||||||
|
|
||||||
|
//only called by the nio thread
|
||||||
static inline void ioevent_add_to_deleted_list(struct fast_task_info *task)
|
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;
|
logWarning("file: "__FILE__", line: %d, "
|
||||||
}
|
|
||||||
|
|
||||||
if (task->canceled) {
|
|
||||||
logError("file: "__FILE__", line: %d, "
|
|
||||||
"task %p already canceled", __LINE__, task);
|
"task %p already canceled", __LINE__, task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
task->canceled = true;
|
|
||||||
task->next = task->thread_data->deleted_list;
|
task->next = task->thread_data->deleted_list;
|
||||||
task->thread_data->deleted_list = task;
|
task->thread_data->deleted_list = task;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue