thread.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2020 Kaspar Schleiser <kaspar@schleiser.de>
3  * SPDX-FileCopyrightText: 2020 Freie Universität Berlin
4  * SPDX-FileCopyrightText: 2020 Inria
5  * SPDX-License-Identifier: LGPL-2.1-only
6  */
7 
8 #pragma once
9 
52 #include <stddef.h>
53 
54 #include "event.h"
55 
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59 
72 void event_thread_init_multi(event_queue_t *queues, size_t queues_numof,
73  char *stack, size_t stack_size,
74  unsigned priority);
75 
84 static inline void event_thread_init(event_queue_t *queue,
85  char *stack, size_t stack_size,
86  unsigned priority)
87 {
88  event_thread_init_multi(queue, 1, stack, stack_size, priority);
89 }
90 
98 enum {
103 };
104 
105 extern event_queue_t event_thread_queues[EVENT_QUEUE_PRIO_NUMOF];
106 
110 #define EVENT_PRIO_HIGHEST (&event_thread_queues[EVENT_QUEUE_PRIO_HIGHEST])
114 #define EVENT_PRIO_MEDIUM (&event_thread_queues[EVENT_QUEUE_PRIO_MEDIUM])
118 #define EVENT_PRIO_LOWEST (&event_thread_queues[EVENT_QUEUE_PRIO_LOWEST])
119 
120 #ifdef __cplusplus
121 }
122 #endif
event queue structure
Definition: event.h:150
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:84
@ EVENT_QUEUE_PRIO_LOWEST
Lowest event queue priority.
Definition: thread.h:101
@ EVENT_QUEUE_PRIO_NUMOF
Number of event queue priorities.
Definition: thread.h:102
@ EVENT_QUEUE_PRIO_MEDIUM
Medium event queue priority.
Definition: thread.h:100
@ EVENT_QUEUE_PRIO_HIGHEST
Highest event queue priority.
Definition: thread.h:99
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.