diff --git a/sys/include/sema.h b/sys/include/sema.h index 360c4deb5b..e6545ecf75 100644 --- a/sys/include/sema.h +++ b/sys/include/sema.h @@ -30,6 +30,15 @@ extern "C" { #endif +/** + * @brief Creates semaphore statically. + * + * @param[in] value Initial value for the semaphore. + * + * @return Statically initialized semaphore. + */ +#define SEMA_CREATE(value) { (value), PRIORITY_QUEUE_INIT } + /** * @brief A Semaphore. */ @@ -39,7 +48,7 @@ typedef struct { } sema_t; /** - * @brief Creates semaphore. + * @brief Creates semaphore dynamically. * * @see * The Open Group Base Specifications Issue 7, sem_init() @@ -133,6 +142,7 @@ static inline int sema_wait(sema_t *sema) * * @param[in] sema A semaphore. * + * @return 0, on success * @return -EINVAL, if semaphore is invalid. * @return -EOVERFLOW, if the semaphore's value would overflow. */ diff --git a/sys/sema/sema.c b/sys/sema/sema.c index ac2cc17cea..96a00aea43 100644 --- a/sys/sema/sema.c +++ b/sys/sema/sema.c @@ -173,7 +173,7 @@ int sema_post(sema_t *sema) restoreIRQ(old_state); } - return 1; + return 0; } /** @} */