|
version 1.15.2.1, 2012/08/21 13:15:49
|
version 1.17, 2012/09/10 15:07:53
|
|
Line 638 sched_task_t *schedCallOnce(sched_root_task_t * __rest
|
Line 638 sched_task_t *schedCallOnce(sched_root_task_t * __rest
|
| * @func = task execution function |
* @func = task execution function |
| * @arg = 1st func argument |
* @arg = 1st func argument |
| * @detach = Detach thread from scheduler, if !=0 |
* @detach = Detach thread from scheduler, if !=0 |
| |
* @ss = stack size |
| * @opt_data = Optional data |
* @opt_data = Optional data |
| * @opt_dlen = Optional data length |
* @opt_dlen = Optional data length |
| * return: NULL error or !=NULL new queued task |
* return: NULL error or !=NULL new queued task |
| */ |
*/ |
| sched_task_t *schedThread(sched_root_task_t * __restrict root, sched_task_func_t func, void *arg, |
sched_task_t *schedThread(sched_root_task_t * __restrict root, sched_task_func_t func, void *arg, |
| int detach, void *opt_data, size_t opt_dlen); | int detach, size_t ss, void *opt_data, size_t opt_dlen); |
| #define schedThreadSelf(x) schedThread(TASK_ROOT((x)), TASK_FUNC((x)), TASK_ARG((x)), \ |
#define schedThreadSelf(x) schedThread(TASK_ROOT((x)), TASK_FUNC((x)), TASK_ARG((x)), \ |
| TASK_VAL((x)), TASK_DATA((x)), TASK_DATLEN((x))) | (TASK_FLAG((x)) & 0x1), (size_t) (TASK_FLAG((x)) >> 1), TASK_DATA((x)), TASK_DATLEN((x))) |
| /* |
/* |
| * taskExit() - Exit routine for scheduler task | * sched_taskExit() - Exit routine for scheduler task, explicit required for thread tasks |
| * |
* |
| |
* @task = current task |
| |
* @retcode = return code |
| |
* return: return code |
| |
*/ |
| |
inline void *sched_taskExit(sched_task_t *task, intptr_t retcode); |
| |
/* |
| |
* taskExit() - Exit helper for scheduler task |
| |
* |
| * @t = current executed task |
* @t = current executed task |
| * @x = exit value for task |
* @x = exit value for task |
| * return: none |
* return: none |
| */ |
*/ |
| #define taskExit(t, x) do { assert((t) && TASK_ROOT(t)); \ | #define taskExit(t, x) return sched_taskExit((t), (intptr_t) (x)) |
| if (TASK_ROOT(t)->root_hooks.hook_exec.exit) \ | |
| TASK_ROOT(t)->root_hooks.hook_exec.exit((t), \ | |
| (void*) (x)); \ | |
| TASK_ROOT(t)->root_ret = (void*) (x); \ | |
| if (TASK_TYPE(t) == taskTHREAD) { \ | |
| sched_unuseTask(t); \ | |
| pthread_exit((void*) (x)); \ | |
| } else \ | |
| 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) | |
| |
|
| |
|
| #endif |
#endif |