1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

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

core/mutex: support locked initialization
This commit is contained in:
Martine Lenders 2016-12-14 13:58:30 +01:00 committed by GitHub
commit 7b272c5f14
2 changed files with 12 additions and 2 deletions

View File

@ -49,6 +49,18 @@ typedef struct {
*/
#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.
* @details For initialization of variables use MUTEX_INIT instead.

View File

@ -35,8 +35,6 @@
#define ENABLE_DEBUG (0)
#include "debug.h"
#define MUTEX_LOCKED ((void*)-1)
int _mutex_lock(mutex_t *mutex, int blocking)
{
unsigned irqstate = irq_disable();