Skip to content
Snippets Groups Projects
Commit 7b272c5f authored by Martine Lenders's avatar Martine Lenders Committed by GitHub
Browse files

Merge pull request #6210 from lebrush/mutex-locked-init

core/mutex: support locked initialization
parents bdd7d644 ea12433a
No related branches found
No related tags found
No related merge requests found
...@@ -49,6 +49,18 @@ typedef struct { ...@@ -49,6 +49,18 @@ typedef struct {
*/ */
#define MUTEX_INIT { { NULL } } #define MUTEX_INIT { { NULL } }
/**
* @brief Static initializer for mutex_t with a locked mutex
*/
#define MUTEX_INIT_LOCKED { { MUTEX_LOCKED } }
/**
* @internal
* @brief This is the value of the mutex when locked and no threads are waiting
* for it
*/
#define MUTEX_LOCKED ((void *)-1)
/** /**
* @brief Initializes a mutex object. * @brief Initializes a mutex object.
* @details For initialization of variables use MUTEX_INIT instead. * @details For initialization of variables use MUTEX_INIT instead.
......
...@@ -35,8 +35,6 @@ ...@@ -35,8 +35,6 @@
#define ENABLE_DEBUG (0) #define ENABLE_DEBUG (0)
#include "debug.h" #include "debug.h"
#define MUTEX_LOCKED ((void*)-1)
int _mutex_lock(mutex_t *mutex, int blocking) int _mutex_lock(mutex_t *mutex, int blocking)
{ {
unsigned irqstate = irq_disable(); unsigned irqstate = irq_disable();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment