add member thread_loop_callback in nio_thread_data
parent
f4dacfda98
commit
b0494666ad
3
HISTORY
3
HISTORY
|
|
@ -1,8 +1,9 @@
|
|||
|
||||
Version 1.06 2014-06-05
|
||||
Version 1.06 2014-06-06
|
||||
* update source code from FastDFS V5.02
|
||||
* add function short2buff and buff2short
|
||||
* add object memory pool (fast_mblock.h and fast_mblock.c)
|
||||
* add member thread_loop_callback in nio_thread_data
|
||||
|
||||
Version 1.05 2012-07-08
|
||||
* update source code from FastDFS V3.09
|
||||
|
|
|
|||
|
|
@ -19,10 +19,12 @@
|
|||
#include "ioevent.h"
|
||||
#include "fast_timer.h"
|
||||
|
||||
struct nio_thread_data;
|
||||
struct fast_task_info;
|
||||
|
||||
typedef int (*TaskFinishCallBack) (struct fast_task_info *pTask);
|
||||
typedef void (*TaskCleanUpCallBack) (struct fast_task_info *pTask);
|
||||
typedef int (*ThreadLoopCallback) (struct nio_thread_data *pThreadData);
|
||||
typedef int (*TaskFinishCallback) (struct fast_task_info *pTask);
|
||||
typedef void (*TaskCleanUpCallback) (struct fast_task_info *pTask);
|
||||
|
||||
typedef void (*IOEventCallback) (int sock, short event, void *arg);
|
||||
|
||||
|
|
@ -39,6 +41,7 @@ struct nio_thread_data
|
|||
struct fast_timer timer;
|
||||
int pipe_fds[2];
|
||||
struct fast_task_info *deleted_list;
|
||||
ThreadLoopCallback thread_loop_callback;
|
||||
void *arg; //extra argument pointer
|
||||
};
|
||||
|
||||
|
|
@ -52,7 +55,7 @@ struct fast_task_info
|
|||
int length; //data length
|
||||
int offset; //current offset
|
||||
int req_count; //request count
|
||||
TaskFinishCallBack finish_callback;
|
||||
TaskFinishCallback finish_callback;
|
||||
struct nio_thread_data *thread_data;
|
||||
struct fast_task_info *next;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ static void deal_timeouts(FastTimerEntry *head)
|
|||
}
|
||||
|
||||
int ioevent_loop(struct nio_thread_data *pThreadData,
|
||||
IOEventCallback recv_notify_callback, TaskCleanUpCallBack
|
||||
IOEventCallback recv_notify_callback, TaskCleanUpCallback
|
||||
clean_up_callback, volatile bool *continue_flag)
|
||||
{
|
||||
int result;
|
||||
|
|
@ -109,6 +109,10 @@ int ioevent_loop(struct nio_thread_data *pThreadData,
|
|||
deal_timeouts(&head);
|
||||
}
|
||||
}
|
||||
|
||||
if (pThreadData->thread_loop_callback != NULL) {
|
||||
pThreadData->thread_loop_callback(pThreadData);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
int ioevent_loop(struct nio_thread_data *pThreadData,
|
||||
IOEventCallback recv_notify_callback, TaskCleanUpCallBack
|
||||
IOEventCallback recv_notify_callback, TaskCleanUpCallback
|
||||
clean_up_callback, volatile bool *continue_flag);
|
||||
|
||||
int ioevent_set(struct fast_task_info *pTask, struct nio_thread_data *pThread,
|
||||
|
|
|
|||
Loading…
Reference in New Issue