|
version 1.24.2.4, 2014/06/03 20:39:54
|
version 1.27.2.1, 2019/01/31 22:31:40
|
|
Line 12 terms:
|
Line 12 terms:
|
| All of the documentation and software included in the ELWIX and AITNET |
All of the documentation and software included in the ELWIX and AITNET |
| Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
| |
|
| Copyright 2004 - 2014 | Copyright 2004 - 2019 |
| by Michael Pounov <misho@elwix.org>. All rights reserved. |
by Michael Pounov <misho@elwix.org>. All rights reserved. |
| |
|
| Redistribution and use in source and binary forms, with or without |
Redistribution and use in source and binary forms, with or without |
|
Line 97 sched_unuseTask(sched_task_t * __restrict task)
|
Line 97 sched_unuseTask(sched_task_t * __restrict task)
|
| return task; |
return task; |
| } |
} |
| |
|
| #pragma GCC visibility push(hidden) |
|
| |
|
| #ifdef HAVE_LIBPTHREAD |
|
| void * |
|
| _sched_threadWrapper(sched_task_t *t) |
|
| { |
|
| void *ret = NULL; |
|
| sched_root_task_t *r; |
|
| |
|
| if (!t || !TASK_ROOT(t)) |
|
| pthread_exit(ret); |
|
| else |
|
| r = (sched_root_task_t*) TASK_ROOT(t); |
|
| |
|
| pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); |
|
| /* |
|
| pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); |
|
| */ |
|
| |
|
| /* notify parent, thread is ready for execution */ |
|
| pthread_testcancel(); |
|
| |
|
| ret = schedCall(t); |
|
| r->root_ret = ret; |
|
| |
|
| if (TASK_VAL(t)) { |
|
| transit_task2unuse(t, &r->root_thread); |
|
| TASK_VAL(t) = 0; |
|
| } |
|
| |
|
| pthread_exit(ret); |
|
| } |
|
| #endif |
|
| |
|
| #if defined(HAVE_TIMER_CREATE) && defined(HAVE_TIMER_SETTIME) && defined(HAVE_TIMER_DELETE) |
|
| void * |
|
| _sched_rtcWrapper(sched_task_t *t) |
|
| { |
|
| sched_task_t *task; |
|
| void *ret; |
|
| |
|
| if (!t || !TASK_ROOT(t) || !TASK_DATA(t)) |
|
| return NULL; |
|
| else { |
|
| task = (sched_task_t*) TASK_DATA(t); |
|
| timer_delete((timer_t) TASK_DATLEN(t)); |
|
| } |
|
| |
|
| ret = schedCall(task); |
|
| |
|
| transit_task2unuse(task, &(TASK_ROOT(task))->root_rtc); |
|
| return ret; |
|
| } |
|
| #endif |
|
| |
|
| #pragma GCC visibility pop |
|
| |
|
| /* |
/* |
| * sched_taskExit() - Exit routine for scheduler task, explicit required for thread tasks |
* sched_taskExit() - Exit routine for scheduler task, explicit required for thread tasks |
| * |
* |
|
Line 325 schedNode(sched_root_task_t * __restrict root, sched_t
|
Line 268 schedNode(sched_root_task_t * __restrict root, sched_t
|
| } |
} |
| |
|
| /* |
/* |
| |
* schedNode2() - Add NODE task with all events to scheduler queue |
| |
* |
| |
* @root = root task |
| |
* @func = task execution function |
| |
* @arg = 1st func argument |
| |
* @fd = fd handle |
| |
* @opt_data = Optional data |
| |
* @opt_dlen = Optional data length |
| |
* return: NULL error or !=NULL new queued task |
| |
*/ |
| |
sched_task_t * |
| |
schedNode2(sched_root_task_t * __restrict root, sched_task_func_t func, void *arg, int fd, |
| |
void *opt_data, size_t opt_dlen) |
| |
{ |
| |
#if SUP_ENABLE != KQ_SUPPORT |
| |
sched_SetErr(ENOTSUP, "disabled kqueue support"); |
| |
return NULL; |
| |
#else |
| |
sched_task_t *task; |
| |
void *ptr; |
| |
|
| |
if (!root || !func) |
| |
return NULL; |
| |
|
| |
/* get new task */ |
| |
if (!(task = sched_useTask(root))) |
| |
return NULL; |
| |
|
| |
TASK_FUNC(task) = func; |
| |
TASK_TYPE(task) = taskNODE; |
| |
TASK_ROOT(task) = root; |
| |
|
| |
TASK_ARG(task) = arg; |
| |
TASK_FD(task) = fd; |
| |
|
| |
TASK_DATA(task) = opt_data; |
| |
TASK_DATLEN(task) = opt_dlen; |
| |
|
| |
if (root->root_hooks.hook_add.node) |
| |
#ifdef __FreeBSD__ |
| |
ptr = root->root_hooks.hook_add.node(task, |
| |
(void*) (NOTE_READ | NOTE_CLOSE_WRITE | NOTE_CLOSE | NOTE_OPEN)); |
| |
#else |
| |
ptr = root->root_hooks.hook_add.node(task, NULL); |
| |
#endif |
| |
else |
| |
ptr = NULL; |
| |
|
| |
if (!ptr) |
| |
insert_task_to(task, &root->root_node); |
| |
else |
| |
task = sched_unuseTask(task); |
| |
|
| |
return task; |
| |
#endif /* KQ_SUPPORT */ |
| |
} |
| |
|
| |
/* |
| * schedProc() - Add PROC task to scheduler queue |
* schedProc() - Add PROC task to scheduler queue |
| * |
* |
| * @root = root task |
* @root = root task |
|
Line 1278 sched_task_t *
|
Line 1279 sched_task_t *
|
| schedRTC(sched_root_task_t * __restrict root, sched_task_func_t func, void *arg, struct timespec ts, |
schedRTC(sched_root_task_t * __restrict root, sched_task_func_t func, void *arg, struct timespec ts, |
| void *opt_data, size_t opt_dlen) |
void *opt_data, size_t opt_dlen) |
| { |
{ |
| #if defined(HAVE_TIMER_CREATE) && defined(HAVE_TIMER_SETTIME) && defined(HAVE_TIMER_DELETE) | #if defined(HAVE_LIBRT) && defined(HAVE_TIMER_CREATE) && \ |
| | defined(HAVE_TIMER_SETTIME) && defined(HAVE_TIMER_DELETE) |
| sched_task_t *task; |
sched_task_t *task; |
| void *ptr; |
void *ptr; |
| |
|