source: libbsdport/bsd_eth_drivers/libbsdport/taskqueue.h @ a8bf95d

B_20100615baselibbsdport-4-10-branch
Last change on this file since a8bf95d was a8bf95d, checked in by Till Straumann <strauman@…>, on Apr 22, 2009 at 10:06:58 PM
  • importing updated version from SLAC as of 20090422
  • Property mode set to 100644
File size: 1.3 KB
Line 
1#ifndef RTEMS_TASKQUEUE_H
2#define RTEMS_TASKQUEUE_H
3
4#include <stdarg.h>
5
6#ifdef __cplusplus
7extern "C" {
8#endif
9
10struct taskqueue;
11
12typedef void (*task_fn)(void *ctxt, int pending);
13
14/* forwarded 'ctxt' that was passed to taskqueue_create() */
15typedef void (*tq_enq_fn)(void *ctxt);
16
17struct task {
18        struct task *ta_next;
19        int                  ta_pending;
20        int                  ta_priority;
21        task_fn      ta_fn;
22        void        *ta_fn_arg;
23};
24
25struct taskqueue *
26taskqueue_create(const char *name, int mflags, tq_enq_fn, void *ctxt);
27
28struct taskqueue *
29taskqueue_create_fast(const char *name, int mflags, tq_enq_fn, void *ctxt);
30
31int
32taskqueue_enqueue(struct taskqueue *tq, struct task *ta);
33
34void
35taskqueue_thread_enqueue(void *ctxt);
36
37#define PI_NET  150
38/* Returns 0 on success */
39int
40taskqueue_start_threads(struct taskqueue **ptq, int count, int prio, const char *fmt, ...);
41
42void
43taskqueue_drain(struct taskqueue *tq, struct task *ta);
44
45void
46taskqueue_free(struct taskqueue *tq);
47
48#define TASK_INIT(task, pri, fn, arg) \
49        do { \
50                (task)->ta_next     = 0; \
51                (task)->ta_priority = (pri); \
52                (task)->ta_pending  = 0; \
53                (task)->ta_fn       = (fn); \
54                (task)->ta_fn_arg   = (arg); \
55        } while (0)
56
57extern struct taskqueue *taskqueue_fast;
58
59/* Initialize taskqueue facility [networking must have been initialized already] */
60rtems_id
61rtems_taskqueue_initialize();
62
63#ifdef __cplusplus
64}
65#endif
66
67#endif
Note: See TracBrowser for help on using the repository browser.