2013-06-22 05:11:53 +02:00
|
|
|
/**
|
|
|
|
* Semaphore data struct and prototypes
|
|
|
|
*
|
|
|
|
* Copyright (C) 2013 INRIA.
|
|
|
|
*
|
|
|
|
* This file subject to the terms and conditions of the GNU Lesser General
|
|
|
|
* Public License. See the file LICENSE in the top level directory for more
|
|
|
|
* details.
|
|
|
|
*
|
|
|
|
* @ingroup sixlowpan
|
|
|
|
* @{
|
|
|
|
* @file semaphore.h
|
|
|
|
* @brief data struct and prototypes for semaphores
|
|
|
|
* @author Martin Lenders <mlenders@inf.fu-berlin.de>
|
|
|
|
* @author Oliver Hahm <oliver.hahm@inria.fr>
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2013-08-05 16:10:54 +02:00
|
|
|
#ifndef _SIXLOWPAN_SEMAPHORE_H
|
|
|
|
#define _SIXLOWPAN_SEMAPHORE_H
|
2011-07-09 20:34:20 +02:00
|
|
|
|
|
|
|
#include <stdint.h>
|
2013-08-08 13:39:00 +02:00
|
|
|
|
|
|
|
#include "mutex.h"
|
2011-07-09 20:34:20 +02:00
|
|
|
|
|
|
|
typedef struct sem_t {
|
|
|
|
int8_t value;
|
|
|
|
int8_t locked;
|
|
|
|
mutex_t mutex;
|
|
|
|
} sem_t;
|
|
|
|
|
2011-07-28 18:25:57 +02:00
|
|
|
void sem_init(sem_t *sem, int8_t value);
|
2011-07-09 20:34:20 +02:00
|
|
|
int sem_wait(sem_t *sem);
|
|
|
|
int sem_signal(sem_t *sem);
|
2013-06-22 05:11:53 +02:00
|
|
|
|
2013-08-05 16:10:54 +02:00
|
|
|
#endif /* _SIXLOWPAN_SEMAPHORE_H*/
|