version 1.14.2.1, 2012/08/21 11:07:16
|
version 1.15.2.1, 2012/08/21 13:15:49
|
Line 53 SUCH DAMAGE.
|
Line 53 SUCH DAMAGE.
|
#include <sys/uio.h> |
#include <sys/uio.h> |
#include <stdint.h> |
#include <stdint.h> |
#include <pthread.h> |
#include <pthread.h> |
|
#include <assert.h> |
#ifdef EVFILT_LIO |
#ifdef EVFILT_LIO |
#include <aio.h> |
#include <aio.h> |
#endif |
#endif |
Line 173 struct sched_Task {
|
Line 174 struct sched_Task {
|
#define TASK_ROOT(x) (x)->task_root |
#define TASK_ROOT(x) (x)->task_root |
sched_task_func_t task_func; |
sched_task_func_t task_func; |
#define TASK_FUNC(x) (x)->task_func |
#define TASK_FUNC(x) (x)->task_func |
|
intptr_t task_ret; |
|
#define TASK_RET(x) (x)->task_ret |
|
unsigned int task_flag; |
|
#define TASK_FLAG(x) (x)->task_flag |
|
|
void *task_arg; |
void *task_arg; |
union { |
union { |
Line 264 int schedEnd(sched_root_task_t ** __restrict root);
|
Line 269 int schedEnd(sched_root_task_t ** __restrict root);
|
*/ |
*/ |
int schedRegisterHooks(sched_root_task_t * __restrict root); |
int schedRegisterHooks(sched_root_task_t * __restrict root); |
/* |
/* |
|
* sched_useTask() - Get and init new task |
|
* |
|
* @root = root task |
|
* return: NULL error or !=NULL prepared task |
|
*/ |
|
inline sched_task_t *sched_useTask(sched_root_task_t * __restrict root); |
|
/* |
|
* sched_unuseTask() - Unlock and put task to unuse queue |
|
* |
|
* @task = task |
|
* return: always is NULL |
|
*/ |
|
inline sched_task_t *sched_unuseTask(sched_task_t * __restrict task); |
|
/* |
* schedPolling() - Polling timeout period if no timer task is present |
* schedPolling() - Polling timeout period if no timer task is present |
* |
* |
* @root = root task |
* @root = root task |
Line 636 sched_task_t *schedThread(sched_root_task_t * __restri
|
Line 655 sched_task_t *schedThread(sched_root_task_t * __restri
|
*/ |
*/ |
#define taskExit(t, x) do { assert((t) && TASK_ROOT(t)); \ |
#define taskExit(t, x) do { assert((t) && TASK_ROOT(t)); \ |
if (TASK_ROOT(t)->root_hooks.hook_exec.exit) \ |
if (TASK_ROOT(t)->root_hooks.hook_exec.exit) \ |
TASK_ROOT(t)->root_hooks.hook_exec.exit((t), (x)); \ | TASK_ROOT(t)->root_hooks.hook_exec.exit((t), \ |
| (void*) (x)); \ |
TASK_ROOT(t)->root_ret = (void*) (x); \ |
TASK_ROOT(t)->root_ret = (void*) (x); \ |
if (TASK_TYPE(t) == taskTHREAD) \ | if (TASK_TYPE(t) == taskTHREAD) { \ |
| sched_unuseTask(t); \ |
pthread_exit((void*) (x)); \ |
pthread_exit((void*) (x)); \ |
else \ | } else \ |
return ((void*) (x)); \ |
return ((void*) (x)); \ |
|
} while (0) |
|
#define taskKill(t, s) do { assert((t) && TASK_ROOT(t)); \ |
|
if (TASK_TYPE(t) == taskTHREAD) { \ |
|
pthread_t _tid = (pthread_t) TASK_VAL((t)); \ |
|
sched_unuseTask(t); \ |
|
pthread_kill(_tid, (s)); \ |
|
} else \ |
|
schedCancel((t)); \ |
} while (0) |
} while (0) |
|
|
|
|