add function locked_list_count
parent
6a3bcd4547
commit
76ef22d380
|
|
@ -32,6 +32,11 @@ 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);
|
||||
|
||||
static inline bool ioevent_is_canceled(struct fast_task_info *task)
|
||||
{
|
||||
return __sync_fetch_and_add(&task->canceled, 0) != 0;
|
||||
}
|
||||
|
||||
//only called by the nio thread
|
||||
static inline void ioevent_add_to_deleted_list(struct fast_task_info *task)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -48,6 +48,15 @@ extern "C" {
|
|||
PTHREAD_MUTEX_UNLOCK(&list->lock);
|
||||
}
|
||||
|
||||
static inline int locked_list_count(FCLockedList *list)
|
||||
{
|
||||
int count;
|
||||
PTHREAD_MUTEX_LOCK(&list->lock);
|
||||
count = fc_list_count(&list->head);
|
||||
PTHREAD_MUTEX_UNLOCK(&list->lock);
|
||||
return count;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue