Skip to content

Commit

Permalink
fixup! core: implement core_mutex_mitigate_priority_inversion
Browse files Browse the repository at this point in the history
  • Loading branch information
maribu committed May 18, 2022
1 parent d4444d4 commit 286f025
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions core/include/mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,22 @@ typedef struct {
uint8_t cancelled; /**< Flag whether the mutex has been cancelled */
} mutex_cancel_t;

#ifndef __cplusplus
/**
* @brief Static initializer for mutex_t.
* @details This initializer is preferable to mutex_init().
*/
#define MUTEX_INIT { .queue = { .next = NULL } }
# define MUTEX_INIT { .queue = { .next = NULL } }

/**
* @brief Static initializer for mutex_t with a locked mutex
*/
#define MUTEX_INIT_LOCKED { .queue = { .next = MUTEX_LOCKED } }
# define MUTEX_INIT_LOCKED { .queue = { .next = MUTEX_LOCKED } }
#else
# define MUTEX_INIT { }
# define MUTEX_INIT_LOCKED { { MUTEX_LOCKED} }
#endif /* __cplusplus */


/**
* @cond INTERNAL
Expand Down
2 changes: 1 addition & 1 deletion sys/cpp11-compat/include/riot/mutex.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class mutex {
*/
using native_handle_type = mutex_t*;

inline constexpr mutex() noexcept : m_mtx{{0}} {}
inline constexpr mutex() noexcept : m_mtx{} {}
~mutex();

/**
Expand Down

0 comments on commit 286f025

Please # to comment.