Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
ee945978
Commit
ee945978
authored
7 years ago
by
Kaspar Schleiser
Browse files
Options
Downloads
Patches
Plain Diff
core: thread_flags: improve documentation
parent
c177a1a7
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/include/thread_flags.h
+43
-7
43 additions, 7 deletions
core/include/thread_flags.h
with
43 additions
and
7 deletions
core/include/thread_flags.h
+
43
−
7
View file @
ee945978
...
...
@@ -7,12 +7,9 @@
*/
/**
* @ingroup core_thread
* @defgroup core_thread_flags Thread Flags
* @ingroup core
* @brief Thread flags
* @{
*
* @file
* @brief Thread flags API
*
* This API can be used to notify threads of conditions in a race-free
* and allocation-less way.
...
...
@@ -45,11 +42,22 @@
* Note that some flags (currently the three most significant bits) are used by
* core functions and should not be set by the user. They can be waited for.
*
* This API is optional and must be enabled by adding "core_thread_flags" to USEMODULE.
*
* @{
*
* @file
* @brief Thread Flags API
*
* @author Kaspar Schleiser <kaspar@schleiser.de>
*/
#ifndef THREAD_FLAGS_H
#define THREAD_FLAGS_H
#ifndef MODULE_CORE_THREAD_FLAGS
#error Missing USEMODULE += core_thread_flags
#endif
#include
"kernel_types.h"
#include
"sched.h"
/* for thread_t typedef */
...
...
@@ -61,13 +69,41 @@
* @name reserved thread flags
* @{
*/
/**
* @brief Set when a message becomes available
*
* This flag is set for a thread if a message becomes available either by being
* queued in the thread's message queue or by another thread becoming
* send-blocked.
*
* It is only reset through thread_flags_wait_*(), not by msg_receive().
*
* One thread flag event might point to one, many or no messages ready to be
* received. It is advisable to use the non-blocking @ref msg_try_receive() in
* a loop to retrieve the messages.
* Use e.g., the following pattern when waiting for both thread flags and
* messages:
*
* while(1) {
* thread_flags_t flags = thread_flags_wait_any(0xFFFF);
* if (flags & THREAD_FLAG_MSG_WAITING) {
* msg_t msg;
* while (msg_try_receive(&msg) == 1) {
* [ handle msg ]
* }
* }
* ...
* }
*/
#define THREAD_FLAG_MSG_WAITING (0x1<<15)
#define THREAD_FLAG_MUTEX_UNLOCKED (0x1<<14)
#define THREAD_FLAG_TIMEOUT (0x1<<13)
/** @} */
/**
* @
nam
e
D
efin
e type
of thread_flags_t
* @
brief Typ
e
d
efin
ition
of thread_flags_t
*/
typedef
uint16_t
thread_flags_t
;
...
...
@@ -151,5 +187,5 @@ int thread_flags_wake(thread_t *thread);
}
#endif
/** @} */
#endif
/* THREAD_FLAGS_H */
/** @} */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment