source: rtems-libbsd/rtemsbsd/include/machine/rtems-bsd-taskqueue.h @ b84c04e

4.1155-freebsd-126-freebsd-12freebsd-9.3
Last change on this file since b84c04e was bceabc9, checked in by Sebastian Huber <sebastian.huber@…>, on 10/09/13 at 20:42:09

Move files to match FreeBSD layout

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup rtems_bsd_rtems
5 *
6 * @brief TODO.
7 */
8
9/*
10 *  COPYRIGHT (c) 1989-2012.
11 *  On-Line Applications Research Corporation (OAR).
12 *
13 * The license and distribution terms for this file may be
14 * found in the file LICENSE in this distribution or at
15 * http://www.rtems.com/license/LICENSE.
16 */
17
18#ifndef RTEMS_TASKQUEUE_H
19#define RTEMS_TASKQUEUE_H
20
21#include <stdarg.h>
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27struct taskqueue;
28
29typedef void (*task_fn)(void *ctxt, int pending);
30
31/* forwarded 'ctxt' that was passed to taskqueue_create() */
32typedef void (*tq_enq_fn)(void *ctxt);
33
34struct task {
35        struct task *ta_next;
36        int                  ta_pending;
37        int                  ta_priority;
38        task_fn      ta_fn;
39        void        *ta_fn_arg;
40};
41
42struct taskqueue *
43taskqueue_create(const char *name, int mflags, tq_enq_fn, void *ctxt);
44
45struct taskqueue *
46taskqueue_create_fast(const char *name, int mflags, tq_enq_fn, void *ctxt);
47
48int
49taskqueue_enqueue(struct taskqueue *tq, struct task *ta);
50
51void
52taskqueue_thread_enqueue(void *ctxt);
53
54#define PI_NET  150
55/* Returns 0 on success */
56int
57taskqueue_start_threads(struct taskqueue **ptq, int count, int prio, const char *fmt, ...);
58
59void
60taskqueue_drain(struct taskqueue *tq, struct task *ta);
61
62void
63taskqueue_free(struct taskqueue *tq);
64
65#define TASK_INIT(task, pri, fn, arg) \
66        do { \
67                (task)->ta_next     = 0; \
68                (task)->ta_priority = (pri); \
69                (task)->ta_pending  = 0; \
70                (task)->ta_fn       = (fn); \
71                (task)->ta_fn_arg   = (arg); \
72        } while (0)
73
74extern struct taskqueue *taskqueue_fast;
75
76/* Initialize taskqueue facility [networking must have been initialized already] */
77rtems_id
78rtems_taskqueue_initialize();
79
80#ifdef __cplusplus
81}
82#endif
83
84#endif
Note: See TracBrowser for help on using the repository browser.