Annotation of libaitsched/inc/aitsched.h, revision 1.11.2.2
1.1 misho 1: /*************************************************************************
2: * (C) 2011 AITNET ltd - Sofia/Bulgaria - <misho@aitbg.com>
3: * by Michael Pounov <misho@openbsd-bg.org>
4: *
5: * $Author: misho $
1.11.2.2! misho 6: * $Id: aitsched.h,v 1.11.2.1 2012/07/30 00:20:26 misho Exp $
1.1 misho 7: *
8: **************************************************************************
9: The ELWIX and AITNET software is distributed under the following
10: terms:
11:
12: All of the documentation and software included in the ELWIX and AITNET
13: Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>
14:
1.6 misho 15: Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
1.1 misho 16: by Michael Pounov <misho@elwix.org>. All rights reserved.
17:
18: Redistribution and use in source and binary forms, with or without
19: modification, are permitted provided that the following conditions
20: are met:
21: 1. Redistributions of source code must retain the above copyright
22: notice, this list of conditions and the following disclaimer.
23: 2. Redistributions in binary form must reproduce the above copyright
24: notice, this list of conditions and the following disclaimer in the
25: documentation and/or other materials provided with the distribution.
26: 3. All advertising materials mentioning features or use of this software
27: must display the following acknowledgement:
28: This product includes software developed by Michael Pounov <misho@elwix.org>
29: ELWIX - Embedded LightWeight unIX and its contributors.
30: 4. Neither the name of AITNET nor the names of its contributors
31: may be used to endorse or promote products derived from this software
32: without specific prior written permission.
33:
34: THIS SOFTWARE IS PROVIDED BY AITNET AND CONTRIBUTORS ``AS IS'' AND
35: ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
36: IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
37: ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
38: FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
39: DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
40: OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
41: HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
42: LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
43: OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
44: SUCH DAMAGE.
45: */
46: #ifndef __AITSCHED_H
47: #define __AITSCHED_H
48:
49:
1.2 misho 50: #include <sys/types.h>
51: #include <sys/queue.h>
52: #include <sys/uio.h>
1.3 misho 53: #include <stdint.h>
1.5 misho 54: #include <pthread.h>
1.2 misho 55:
56:
1.1 misho 57: /* criteria type */
1.10 misho 58: #define CRITERIA_ANY 0
59: #define CRITERIA_CALL 1
60: #define CRITERIA_ARG 2
61: #define CRITERIA_FD 3
62: #define CRITERIA_VAL 4
63: #define CRITERIA_TS 5
64: #define CRITERIA_DATA 6
1.11 misho 65: #define CRITERIA_ID 7
1.1 misho 66:
67:
68: /* early declaration for root & task */
69: typedef struct sched_Task sched_task_t;
70: typedef struct sched_RootTask sched_root_task_t;
71:
72: typedef enum {
73: taskREAD = 0,
74: taskWRITE,
75: taskTIMER,
1.10 misho 76: taskALARM,
77: taskNODE,
78: taskPROC,
79: taskSIGNAL,
1.11.2.2! misho 80: taskAIO,
! 81: taskUSER,
1.9 misho 82: taskEVENT,
83: taskEVENTLO,
1.11 misho 84: taskSUSPEND,
1.1 misho 85: taskREADY,
86: taskUNUSE,
87: taskMAX
88: } sched_task_type_t;
89:
90: /* hooks */
91: typedef void *(*sched_hook_func_t)(void *, void *);
92: struct sched_HooksTask {
93: struct {
94: /* read(sched_task_t *task, NULL) -> int */
95: sched_hook_func_t read;
96: /* write(sched_task_t *task, NULL) -> int */
97: sched_hook_func_t write;
1.10 misho 98: /* timer(sched_task_t *task, struct timespec *ts) -> int */
99: sched_hook_func_t timer;
100: /* alarm(sched_task_t *task, NULL) -> int */
101: sched_hook_func_t alarm;
102: /* node(sched_task_t *task, NULL) -> int */
103: sched_hook_func_t node;
104: /* proc(sched_task_t *task, NULL) -> int */
105: sched_hook_func_t proc;
106: /* signal(sched_task_t *task, NULL) -> int */
107: sched_hook_func_t signal;
1.11.2.2! misho 108: /* aio(sched_task_t *task, NULL) -> int */
! 109: sched_hook_func_t aio;
! 110: /* user(sched_task_t *task, NULL) -> int */
! 111: sched_hook_func_t user;
1.1 misho 112: /* event(sched_task_t *task, NULL) -> int */
113: sched_hook_func_t event;
114: /* eventlo(sched_task_t *task, NULL) -> int */
115: sched_hook_func_t eventlo;
1.11 misho 116: /* suspend(sched_task_t *task, NULL) -> int */
117: sched_hook_func_t suspend;
1.1 misho 118: } hook_add;
119: struct {
120: /* cancel(sched_task_t *task, NULL) -> int */
121: sched_hook_func_t cancel;
1.11 misho 122: /* resume(sched_task_t *task, NULL) -> int */
123: sched_hook_func_t resume;
1.1 misho 124: /* run(sched_root_task_t *root, NULL) -> int */
125: sched_hook_func_t run;
126: /* fetch(sched_root_task_t *root, NULL) -> sched_task_t* */
127: sched_hook_func_t fetch;
1.3 misho 128: /* exception(sched_root_task_t *root, NULL) -> int */
129: sched_hook_func_t exception;
1.6 misho 130: /* condition(sched_root_task_t *root, intptr_t *stopValue) -> int */
131: sched_hook_func_t condition;
1.1 misho 132: } hook_exec;
133: struct {
134: /* init(sched_root_task_t *root, void *data) -> int */
135: sched_hook_func_t init;
136: /* fini(sched_root_task_t *root, NULL) -> int */
137: sched_hook_func_t fini;
1.3 misho 138: /* error(sched_root_task_t *root, int errno) -> int */
139: sched_hook_func_t error;
1.1 misho 140: } hook_root;
141: };
142: typedef struct sched_HooksTask hooks_task_t;
143:
144: /* task callback, like pthread callback! */
1.2 misho 145: typedef void *(*sched_task_func_t)(sched_task_t * /* current task data*/);
1.1 misho 146:
1.4 misho 147: /* task lock helpers */
1.10 misho 148: #define TASK_LOCK(x) ((x)->task_lock = 42)
1.4 misho 149: #define TASK_UNLOCK(x) ((x)->task_lock ^= (x)->task_lock)
150: #define TASK_ISLOCKED(x) ((x)->task_lock)
151:
1.1 misho 152: /* task & queue */
153: struct sched_Task {
1.4 misho 154: volatile int task_lock;
1.10 misho 155: uintptr_t task_id;
156: #define TASK_ID(x) ((struct sched_Task*) (x)->task_id)
1.1 misho 157: sched_task_type_t task_type;
1.5 misho 158: #define TASK_TYPE(x) (x)->task_type
1.1 misho 159:
160: sched_root_task_t *task_root;
1.2 misho 161: #define TASK_ROOT(x) (x)->task_root
1.1 misho 162: sched_task_func_t task_func;
1.8 misho 163: #define TASK_FUNC(x) (x)->task_func
1.1 misho 164:
165: void *task_arg;
166: union {
167: unsigned long v;
1.3 misho 168: intptr_t fd;
1.5 misho 169: struct timespec ts;
1.1 misho 170: } task_val;
171: #define TASK_ARG(x) (x)->task_arg
172: #define TASK_VAL(x) (x)->task_val.v
173: #define TASK_FD(x) (x)->task_val.fd
1.5 misho 174: #define TASK_TS(x) (x)->task_val.ts
1.1 misho 175:
176: struct iovec task_data;
177: #define TASK_DATA(x) (x)->task_data.iov_base
178: #define TASK_DATLEN(x) (x)->task_data.iov_len
179:
180: TAILQ_ENTRY(sched_Task) task_node;
181: };
182: typedef TAILQ_HEAD(, sched_Task) sched_queue_t;
1.5 misho 183: #define TASK_DATA_SET(x, _dp, _dl) do { \
184: if ((x)) { \
185: (x)->task_data.iov_base = (_dp); \
186: (x)->task_data.iov_len = _dl; \
187: } \
188: while (0)
1.1 misho 189:
190: /* root task */
191: struct sched_RootTask {
192: int root_kq;
1.5 misho 193: struct timespec root_wait;
194: struct timespec root_poll;
1.6 misho 195: intptr_t root_cond;
1.11.2.1 misho 196: void *root_ret;
1.6 misho 197:
1.5 misho 198: pthread_mutex_t root_mtx[taskMAX];
1.1 misho 199:
200: sched_queue_t root_read;
201: sched_queue_t root_write;
202: sched_queue_t root_timer;
1.9 misho 203: sched_queue_t root_alarm;
1.10 misho 204: sched_queue_t root_node;
205: sched_queue_t root_proc;
206: sched_queue_t root_signal;
1.11.2.2! misho 207: sched_queue_t root_aio;
! 208: sched_queue_t root_user;
1.1 misho 209: sched_queue_t root_event;
1.10 misho 210: sched_queue_t root_eventlo;
1.11 misho 211: sched_queue_t root_suspend;
1.1 misho 212: sched_queue_t root_ready;
213: sched_queue_t root_unuse;
214: int root_eventlo_miss;
215:
216: hooks_task_t root_hooks;
217: struct iovec root_data;
218: #define ROOT_DATA(x) (x)->root_data.iov_base
219: #define ROOT_DATLEN(x) (x)->root_data.iov_len
220: };
1.7 misho 221: #define ROOT_QUEUE_EMPTY(x, _q) TAILQ_EMPTY(&((x)->root_##_q))
1.11.2.1 misho 222: #define ROOT_RETURN(x) (x)->root_ret
1.1 misho 223:
224:
1.2 misho 225: inline int sched_GetErrno();
226: inline const char *sched_GetError();
227:
228:
1.1 misho 229: /*
230: * schedInit() - Init scheduler
1.6 misho 231: *
1.1 misho 232: * @data = optional data if !=NULL
233: * @datlen = data len if data is set
234: * return: allocated root task if ok or NULL error
235: */
236: sched_root_task_t *schedInit(void ** __restrict data, size_t datlen);
1.2 misho 237: #define schedBegin() schedInit((void**) &schedRegisterHooks, 0)
1.1 misho 238: /*
239: * schedEnd() - End scheduler & free all resources
1.6 misho 240: *
1.1 misho 241: * @root = root task
242: * return: -1 error or 0 ok
243: */
1.2 misho 244: int schedEnd(sched_root_task_t ** __restrict root);
1.1 misho 245: /*
1.2 misho 246: * schedRegisterHooks() - Register IO handles and bind tasks to it
1.6 misho 247: *
1.1 misho 248: * @root = root task
249: * return: -1 error or 0 ok
250: */
1.2 misho 251: int schedRegisterHooks(sched_root_task_t * __restrict root);
1.1 misho 252: /*
1.5 misho 253: * schedPolling() - Polling timeout period if no timer task is present
1.6 misho 254: *
1.5 misho 255: * @root = root task
256: * @ts = timeout polling period, if ==NULL INFINIT timeout
257: * @tsold = old timeout polling if !=NULL
258: * return: -1 error or 0 ok
259: */
260: inline int schedPolling(sched_root_task_t * __restrict root,
261: struct timespec * __restrict ts, struct timespec * __restrict tsold);
262: /*
1.6 misho 263: * schedTermCondition() - Activate hook for scheduler condition kill
264: *
265: * @root = root task
266: * @condValue = condition value, kill schedRun() if condValue == killState
267: * return: -1 error ok 0 ok
268: */
269: inline int schedTermCondition(sched_root_task_t * __restrict root, intptr_t condValue);
270: /*
1.1 misho 271: * schedCall() - Call task execution function
1.6 misho 272: *
1.1 misho 273: * @task = current task
274: * return: !=NULL error or =NULL ok
275: */
276: inline void *schedCall(sched_task_t * __restrict task);
277: /*
278: * schedFetch() - Fetch ready task
1.6 misho 279: *
1.1 misho 280: * @root = root task
281: * return: =NULL error or !=NULL ready task
282: */
283: inline void *schedFetch(sched_root_task_t * __restrict root);
284: /*
285: * schedRun() - Scheduler *run loop*
1.6 misho 286: *
1.1 misho 287: * @root = root task
1.2 misho 288: * @killState = kill condition variable, if !=0 stop scheduler loop
1.1 misho 289: * return: -1 error or 0 ok
290: */
1.7 misho 291: int schedRun(sched_root_task_t *root, volatile intptr_t * __restrict killState);
1.1 misho 292: /*
293: * schedCancel() - Cancel task from scheduler
1.6 misho 294: *
1.1 misho 295: * @task = task
296: * return: -1 error or 0 ok
297: */
298: int schedCancel(sched_task_t * __restrict task);
299: /*
300: * schedCancelby() - Cancel task from scheduler by criteria
1.6 misho 301: *
1.1 misho 302: * @root = root task
1.5 misho 303: * @type = cancel from queue type, if =taskMAX cancel same task from all queues
1.10 misho 304: * @criteria = find task by criteria
1.11 misho 305: * [CRITERIA_ANY|CRITERIA_CALL|CRITERIA_ARG|CRITERIA_FD|CRITERIA_VAL|CRITERIA_ID|CRITERIA_TS|CRITERIA_DATA]
1.1 misho 306: * @param = search parameter
307: * @hook = custom cleanup hook function, may be NULL
1.3 misho 308: * return: -1 error, -2 error in sub-stage cancel execution, -3 error from custom hook or 0 ok
1.1 misho 309: */
1.5 misho 310: int schedCancelby(sched_root_task_t * __restrict root, sched_task_type_t type,
1.1 misho 311: u_char criteria, void *param, sched_hook_func_t hook);
312:
313:
314: /*
1.2 misho 315: * schedRead() - Add READ I/O task to scheduler queue
1.6 misho 316: *
1.1 misho 317: * @root = root task
318: * @func = task execution function
319: * @arg = 1st func argument
1.2 misho 320: * @fd = fd handle
1.5 misho 321: * @opt_data = Optional data
322: * @opt_dlen = Optional data length
1.1 misho 323: * return: NULL error or !=NULL new queued task
324: */
1.5 misho 325: sched_task_t *schedRead(sched_root_task_t * __restrict root, sched_task_func_t func, void *arg,
326: int fd, void *opt_data, size_t opt_dlen);
1.8 misho 327: #define schedReadSelf(x) schedRead(TASK_ROOT((x)), TASK_FUNC((x)), TASK_ARG((x)), \
328: TASK_FD((x)), TASK_DATA((x)), TASK_DATLEN((x)))
1.1 misho 329: /*
1.2 misho 330: * schedWrite() - Add WRITE I/O task to scheduler queue
1.6 misho 331: *
1.1 misho 332: * @root = root task
333: * @func = task execution function
334: * @arg = 1st func argument
1.2 misho 335: * @fd = fd handle
1.5 misho 336: * @opt_data = Optional data
337: * @opt_dlen = Optional data length
1.1 misho 338: * return: NULL error or !=NULL new queued task
339: */
1.5 misho 340: sched_task_t *schedWrite(sched_root_task_t * __restrict root, sched_task_func_t func, void *arg,
341: int fd, void *opt_data, size_t opt_dlen);
1.8 misho 342: #define schedWriteSelf(x) schedWrite(TASK_ROOT((x)), TASK_FUNC((x)), TASK_ARG((x)), \
343: TASK_FD((x)), TASK_DATA((x)), TASK_DATLEN((x)))
1.1 misho 344: /*
1.9 misho 345: * schedAlarm() - Add ALARM task to scheduler queue
346: *
347: * @root = root task
348: * @func = task execution function
349: * @arg = 1st func argument
350: * @ts = timeout argument structure, minimum alarm timer resolution is 1msec!
351: * @opt_data = Optional data
352: * @opt_dlen = Optional data length
353: * return: NULL error or !=NULL new queued task
354: */
355: sched_task_t *schedAlarm(sched_root_task_t * __restrict root, sched_task_func_t func, void *arg,
356: struct timespec ts, void *opt_data, size_t opt_dlen);
357: #define schedAlarmSelf(x) schedAlarm(TASK_ROOT((x)), TASK_FUNC((x)), TASK_ARG((x)), \
358: TASK_TS((x)), TASK_DATA((x)), TASK_DATLEN((x)))
359: /*
1.10 misho 360: * schedNode() - Add NODE task to scheduler queue
361: *
362: * @root = root task
363: * @func = task execution function
364: * @arg = 1st func argument
365: * @fd = fd handle
366: * @opt_data = Optional data
367: * @opt_dlen = Optional data length
368: * return: NULL error or !=NULL new queued task
369: */
370: sched_task_t *schedNode(sched_root_task_t * __restrict root, sched_task_func_t func, void *arg,
371: int fd, void *opt_data, size_t opt_dlen);
372: #define schedNodeSelf(x) schedNode(TASK_ROOT((x)), TASK_FUNC((x)), TASK_ARG((x)), \
373: TASK_FD((x)), TASK_DATA((x)), TASK_DATLEN((x)))
374: /*
375: * schedProc() - Add PROC task to scheduler queue
376: *
377: * @root = root task
378: * @func = task execution function
379: * @arg = 1st func argument
380: * @pid = PID
381: * @opt_data = Optional data
382: * @opt_dlen = Optional data length
383: * return: NULL error or !=NULL new queued task
384: */
385: sched_task_t *schedProc(sched_root_task_t * __restrict root, sched_task_func_t func, void *arg,
386: unsigned long pid, void *opt_data, size_t opt_dlen);
387: #define schedProcSelf(x) schedProc(TASK_ROOT((x)), TASK_FUNC((x)), TASK_ARG((x)), \
388: TASK_VAL((x)), TASK_DATA((x)), TASK_DATLEN((x)))
389: /*
390: * schedSignal() - Add SIGNAL task to scheduler queue
391: *
392: * @root = root task
393: * @func = task execution function
394: * @arg = 1st func argument
395: * @sig = Signal
396: * @opt_data = Optional data
397: * @opt_dlen = Optional data length
398: * return: NULL error or !=NULL new queued task
399: */
400: sched_task_t *schedSignal(sched_root_task_t * __restrict root, sched_task_func_t func, void *arg,
401: unsigned long sig, void *opt_data, size_t opt_dlen);
402: #define schedSignalSelf(x) schedSignal(TASK_ROOT((x)), TASK_FUNC((x)), TASK_ARG((x)), \
403: TASK_VAL((x)), TASK_DATA((x)), TASK_DATLEN((x)))
404:
405: /*
1.11.2.2! misho 406: * schedAIO() - Add AIO task to scheduler queue
! 407: *
! 408: * @root = root task
! 409: * @func = task execution function
! 410: * @arg = 1st func argument
! 411: * @acb = AIO cb structure address
! 412: * @opt_data = Optional data
! 413: * @opt_dlen = Optional data length
! 414: * return: NULL error or !=NULL new queued task
! 415: */
! 416: sched_task_t *schedAIO(sched_root_task_t * __restrict root, sched_task_func_t func, void *arg,
! 417: unsigned long acb, void *opt_data, size_t opt_dlen);
! 418: #define schedAIOSelf(x) schedAIO(TASK_ROOT((x)), TASK_FUNC((x)), TASK_ARG((x)), \
! 419: TASK_VAL((x)), TASK_DATA((x)), TASK_DATLEN((x)))
! 420:
! 421: /*
1.10 misho 422: * schedUser() - Add trigger USER task to scheduler queue
423: *
424: * @root = root task
425: * @func = task execution function
426: * @arg = 1st func argument
427: * @id = Trigger ID
428: * @opt_data = Optional data
429: * @opt_dlen = Optional user's trigger flags
430: * return: NULL error or !=NULL new queued task
431: */
432: sched_task_t *schedUser(sched_root_task_t * __restrict root, sched_task_func_t func, void *arg,
433: unsigned long id, void *opt_data, size_t opt_dlen);
434: #define schedUserSelf(x) schedUser(TASK_ROOT((x)), TASK_FUNC((x)), TASK_ARG((x)), \
435: TASK_VAL((x)), TASK_DATA((x)), TASK_DATLEN((x)))
436: /*
437: * schedTrigger() - Triggering USER task
438: *
439: * @task = task
440: * return: -1 error or 0 ok
441: */
442: int schedTrigger(sched_task_t * __restrict task);
443:
444: /*
1.1 misho 445: * schedTimer() - Add TIMER task to scheduler queue
1.6 misho 446: *
1.1 misho 447: * @root = root task
448: * @func = task execution function
449: * @arg = 1st func argument
1.5 misho 450: * @ts = timeout argument structure
451: * @opt_data = Optional data
452: * @opt_dlen = Optional data length
1.1 misho 453: * return: NULL error or !=NULL new queued task
454: */
1.5 misho 455: sched_task_t *schedTimer(sched_root_task_t * __restrict root, sched_task_func_t func, void *arg,
456: struct timespec ts, void *opt_data, size_t opt_dlen);
1.8 misho 457: #define schedTimerSelf(x) schedTimer(TASK_ROOT((x)), TASK_FUNC((x)), TASK_ARG((x)), \
458: TASK_TS((x)), TASK_DATA((x)), TASK_DATLEN((x)))
1.1 misho 459: /*
460: * schedEvent() - Add EVENT task to scheduler queue
1.6 misho 461: *
1.1 misho 462: * @root = root task
463: * @func = task execution function
464: * @arg = 1st func argument
1.2 misho 465: * @val = additional func argument
1.5 misho 466: * @opt_data = Optional data
467: * @opt_dlen = Optional data length
1.1 misho 468: * return: NULL error or !=NULL new queued task
469: */
1.5 misho 470: sched_task_t *schedEvent(sched_root_task_t * __restrict root, sched_task_func_t func, void *arg,
471: unsigned long val, void *opt_data, size_t opt_dlen);
1.8 misho 472: #define schedEventSelf(x) schedEvent(TASK_ROOT((x)), TASK_FUNC((x)), TASK_ARG((x)), \
473: TASK_VAL((x)), TASK_DATA((x)), TASK_DATLEN((x)))
1.1 misho 474: /*
475: * schedEventLo() - Add EVENT_Lo task to scheduler queue
1.6 misho 476: *
1.1 misho 477: * @root = root task
478: * @func = task execution function
479: * @arg = 1st func argument
1.2 misho 480: * @val = additional func argument
1.5 misho 481: * @opt_data = Optional data
482: * @opt_dlen = Optional data length
1.1 misho 483: * return: NULL error or !=NULL new queued task
484: */
1.5 misho 485: sched_task_t *schedEventLo(sched_root_task_t * __restrict root, sched_task_func_t func, void *arg,
486: unsigned long val, void *opt_data, size_t opt_dlen);
1.8 misho 487: #define schedEventLoSelf(x) schedEventLo(TASK_ROOT((x)), TASK_FUNC((x)), TASK_ARG((x)), \
488: TASK_VAL((x)), TASK_DATA((x)), TASK_DATLEN((x)))
1.11 misho 489: /*
490: * schedSuspend() - Add Suspended task to scheduler queue
491: *
492: * @root = root task
493: * @func = task execution function
494: * @arg = 1st func argument
495: * @id = Trigger ID
496: * @opt_data = Optional data
497: * @opt_dlen = Optional user's trigger flags
498: * return: NULL error or !=NULL new queued task
499: */
500: sched_task_t *schedSuspend(sched_root_task_t * __restrict root, sched_task_func_t func, void *arg,
501: unsigned long id, void *opt_data, size_t opt_dlen);
502: #define schedSuspendSelf(x) schedUser(TASK_ROOT((x)), TASK_FUNC((x)), TASK_ARG((x)), \
503: TASK_VAL((x)), TASK_DATA((x)), TASK_DATLEN((x)))
504: /*
505: * schedResumeby() - Resume suspended task
506: *
507: * @root = root task
508: * @criteria = find task by criteria
509: * [CRITERIA_ANY|CRITERIA_ID|CRITERIA_DATA]
510: * @param = search parameter (sched_task_t *task| u_long id)
511: * return: -1 error or 0 resumed ok
512: */
513: int schedResumeby(sched_root_task_t * __restrict root, unsigned char criteria, void *param);
1.10 misho 514:
1.1 misho 515: /*
516: * schedCallOnce() - Call once from scheduler
1.6 misho 517: *
1.1 misho 518: * @root = root task
519: * @func = task execution function
520: * @arg = 1st func argument
1.2 misho 521: * @val = additional func argument
1.5 misho 522: * @opt_data = Optional data
523: * @opt_dlen = Optional data length
1.2 misho 524: * return: return value from called func
1.1 misho 525: */
1.5 misho 526: sched_task_t *schedCallOnce(sched_root_task_t * __restrict root, sched_task_func_t func, void *arg,
527: unsigned long val, void *opt_data, size_t opt_dlen);
1.8 misho 528: #define schedCallAgain(x) schedCallOnce(TASK_ROOT((x)), TASK_FUNC((x)), TASK_ARG((x)), \
529: TASK_VAL((x)), TASK_DATA((x)), TASK_DATLEN((x)))
1.1 misho 530:
531:
532: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>