diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-02-19 19:55:40 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-02-19 19:55:40 +0000 |
commit | 89376b7141edb6f927fb940c27391cda6e67c785 (patch) | |
tree | 57dd01fd9328b879289493ba848ae5c34c607b91 /bsd_eth_drivers/libbsdport/taskqueue.h | |
download | libbsdport-89376b7141edb6f927fb940c27391cda6e67c785.tar.bz2 |
Initial import.initial
Diffstat (limited to 'bsd_eth_drivers/libbsdport/taskqueue.h')
-rw-r--r-- | bsd_eth_drivers/libbsdport/taskqueue.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/bsd_eth_drivers/libbsdport/taskqueue.h b/bsd_eth_drivers/libbsdport/taskqueue.h new file mode 100644 index 0000000..d700edf --- /dev/null +++ b/bsd_eth_drivers/libbsdport/taskqueue.h @@ -0,0 +1,69 @@ +#ifndef RTEMS_TASKQUEUE_H +#define RTEMS_TASKQUEUE_H + +#include <stdarg.h> + +#ifdef __cplusplus +extern "C" { +#endif + +struct taskqueue; + +typedef void (*task_fn)(void *ctxt, int pending); + +/* forwarded 'ctxt' that was passed to taskqueue_create() */ +typedef void (*tq_enq_fn)(void *ctxt); + +struct task { + struct task *ta_next; + int ta_pending; + int ta_priority; + task_fn ta_fn; + void *ta_fn_arg; +}; + +struct taskqueue * +taskqueue_create(const char *name, int mflags, tq_enq_fn, void *ctxt); + +struct taskqueue * +taskqueue_create_fast(const char *name, int mflags, tq_enq_fn, void *ctxt); + +int +taskqueue_enqueue(struct taskqueue *tq, struct task *ta); + +#define taskqueue_enqueue_fast(_q,_t) taskqueue_enqueue(_q,_t) + +void +taskqueue_thread_enqueue(void *ctxt); + +#define PI_NET 150 +/* Returns 0 on success */ +int +taskqueue_start_threads(struct taskqueue **ptq, int count, int prio, const char *fmt, ...); + +void +taskqueue_drain(struct taskqueue *tq, struct task *ta); + +void +taskqueue_free(struct taskqueue *tq); + +#define TASK_INIT(task, pri, fn, arg) \ + do { \ + (task)->ta_next = 0; \ + (task)->ta_priority = (pri); \ + (task)->ta_pending = 0; \ + (task)->ta_fn = (fn); \ + (task)->ta_fn_arg = (arg); \ + } while (0) + +extern struct taskqueue *taskqueue_fast; + +/* Initialize taskqueue facility [networking must have been initialized already] */ +rtems_id +rtems_taskqueue_initialize(); + +#ifdef __cplusplus +} +#endif + +#endif |