We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2734366 commit 46ecf82Copy full SHA for 46ecf82
core/include/mutex.h
@@ -253,6 +253,17 @@ static inline void mutex_init(mutex_t *mutex)
253
mutex->queue.next = NULL;
254
}
255
256
+/**
257
+ * @brief Initializes a mutex object in a locked state.
258
+ * @details For initialization of variables use MUTEX_INIT_LOCKED instead.
259
+ * Only use the function call for dynamically allocated mutexes.
260
+ * @param[out] mutex pre-allocated mutex structure, must not be NULL.
261
+ */
262
+static inline void mutex_init_locked(mutex_t *mutex)
263
+{
264
+ *mutex = (mutex_t)MUTEX_INIT_LOCKED;
265
+}
266
+
267
/**
268
* @brief Initialize a mutex cancellation structure
269
* @param mutex The mutex that the calling thread wants to lock
0 commit comments