thread_flags.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Kaspar Schleiser <kaspar@schleiser.de>
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
50 #ifndef THREAD_FLAGS_H
51 #define THREAD_FLAGS_H
52 
53 #include "kernel_types.h"
54 #include "sched.h" /* for thread_t typedef */
55 
56 #ifdef __cplusplus
57  extern "C" {
58 #endif
59 
64 #define THREAD_FLAG_MSG_WAITING (0x1<<15)
65 #define THREAD_FLAG_MUTEX_UNLOCKED (0x1<<14)
66 #define THREAD_FLAG_TIMEOUT (0x1<<13)
67 
72 typedef uint16_t thread_flags_t;
73 
81 void thread_flags_set(thread_t *thread, thread_flags_t mask);
82 
91 thread_flags_t thread_flags_clear(thread_flags_t mask);
92 
106 thread_flags_t thread_flags_wait_any(thread_flags_t mask);
107 
121 thread_flags_t thread_flags_wait_all(thread_flags_t mask);
122 
133 thread_flags_t thread_flags_wait_one(thread_flags_t mask);
134 
148 int thread_flags_wake(thread_t *thread);
149 
150 #ifdef __cplusplus
151 }
152 #endif
153 
155 #endif /* THREAD_FLAGS_H */
Types used by the kernel.
thread_flags_t thread_flags_wait_one(thread_flags_t mask)
Wait for any flags in mask to become set (blocking), one at a time.
thread_flags_t thread_flags_clear(thread_flags_t mask)
Clear current thread&#39;s flags.
thread_t holds thread&#39;s context data.
Definition: thread.h:172
void thread_flags_set(thread_t *thread, thread_flags_t mask)
Set thread flags, possibly waking it up.
Scheduler API definition.
int thread_flags_wake(thread_t *thread)
Possibly Wake up thread waiting for flags.
thread_flags_t thread_flags_wait_any(thread_flags_t mask)
Wait for any flag in mask to become set (blocking)
thread_flags_t thread_flags_wait_all(thread_flags_t mask)
Wait for all flags in mask to become set (blocking)