thread.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Kaspar Schleiser <kaspar@schleiser.de>
3  * 2020 Freie Universität Berlin
4  * 2020 Inria
5  *
6  * This file is subject to the terms and conditions of the GNU Lesser
7  * General Public License v2.1. See the file LICENSE in the top level
8  * directory for more details.
9  */
10 
53 #ifndef EVENT_THREAD_H
54 #define EVENT_THREAD_H
55 
56 #include <stddef.h>
57 
58 #include "event.h"
59 
60 #ifdef __cplusplus
61 extern "C" {
62 #endif
63 
76 void event_thread_init_multi(event_queue_t *queues, size_t queues_numof,
77  char *stack, size_t stack_size,
78  unsigned priority);
79 
88 static inline void event_thread_init(event_queue_t *queue,
89  char *stack, size_t stack_size,
90  unsigned priority)
91 {
92  event_thread_init_multi(queue, 1, stack, stack_size, priority);
93 }
94 
102 enum {
107 };
108 
109 extern event_queue_t event_thread_queues[EVENT_QUEUE_PRIO_NUMOF];
110 
114 #define EVENT_PRIO_HIGHEST (&event_thread_queues[EVENT_QUEUE_PRIO_HIGHEST])
118 #define EVENT_PRIO_MEDIUM (&event_thread_queues[EVENT_QUEUE_PRIO_MEDIUM])
122 #define EVENT_PRIO_LOWEST (&event_thread_queues[EVENT_QUEUE_PRIO_LOWEST])
123 
124 #ifdef __cplusplus
125 }
126 #endif
127 #endif /* EVENT_THREAD_H */
event queue structure
Definition: event.h:156
static void event_thread_init(event_queue_t *queue, char *stack, size_t stack_size, unsigned priority)
Convenience function for initializing an event queue thread.
Definition: thread.h:88
@ EVENT_QUEUE_PRIO_LOWEST
Lowest event queue priority.
Definition: thread.h:105
@ EVENT_QUEUE_PRIO_NUMOF
Number of event queue priorities.
Definition: thread.h:106
@ EVENT_QUEUE_PRIO_MEDIUM
Medium event queue priority.
Definition: thread.h:104
@ EVENT_QUEUE_PRIO_HIGHEST
Highest event queue priority.
Definition: thread.h:103
void event_thread_init_multi(event_queue_t *queues, size_t queues_numof, char *stack, size_t stack_size, unsigned priority)
Convenience function for initializing an event queue thread handling multiple queues.