aboutsummaryrefslogtreecommitdiffstats
path: root/src/include/condvars.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/condvars.h')
-rw-r--r--src/include/condvars.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/include/condvars.h b/src/include/condvars.h
index 90c78eccf..d68637f21 100644
--- a/src/include/condvars.h
+++ b/src/include/condvars.h
@@ -58,6 +58,21 @@ extern "C" {
}
#endif
+/**
+ * @brief Data part of a static condition variable initializer.
+ * @details This macro should be used when statically initializing a condition
+ * variable that is part of a bigger structure.
+ */
+#define _CONDVAR_DATA(name) {_THREADSQUEUE_DATA(name.c_queue)}
+
+/**
+ * @brief Static condition variable initializer.
+ * @details Statically initialized condition variables require no explicit
+ * initialization using @p chCondInit().
+ * @param name the name of the condition variable
+ */
+#define CONDVAR_DECL(name) CondVar name = _CONDVAR_DATA(name)
+
#endif /* CH_USE_CONDVARS && CH_USE_MUTEXES */
#endif /* _CONDVARS_H_ */