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 
11 #pragma once
12 
55 #include <stddef.h>
56 
57 #include "event.h"
58 
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62 
75 void event_thread_init_multi(event_queue_t *queues, size_t queues_numof,
76  char *stack, size_t stack_size,
77  unsigned priority);
78 
87 static inline void event_thread_init(event_queue_t *queue,
88  char *stack, size_t stack_size,
89  unsigned priority)
90 {
91  event_thread_init_multi(queue, 1, stack, stack_size, priority);
92 }
93 
101 enum {
106 };
107 
108 extern event_queue_t event_thread_queues[EVENT_QUEUE_PRIO_NUMOF];
109 
113 #define EVENT_PRIO_HIGHEST (&event_thread_queues[EVENT_QUEUE_PRIO_HIGHEST])
117 #define EVENT_PRIO_MEDIUM (&event_thread_queues[EVENT_QUEUE_PRIO_MEDIUM])
121 #define EVENT_PRIO_LOWEST (&event_thread_queues[EVENT_QUEUE_PRIO_LOWEST])
122 
123 #ifdef __cplusplus
124 }
125 #endif
event queue structure
Definition: event.h:153
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:87
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.
@ EVENT_QUEUE_PRIO_LOWEST
Lowest event queue priority.
Definition: thread.h:104
@ EVENT_QUEUE_PRIO_NUMOF
Number of event queue priorities.
Definition: thread.h:105
@ EVENT_QUEUE_PRIO_MEDIUM
Medium event queue priority.
Definition: thread.h:103
@ EVENT_QUEUE_PRIO_HIGHEST
Highest event queue priority.
Definition: thread.h:102