Merge pull request #4551 from authmillenon/sema/fix/post

sema: some API fixes
This commit is contained in:
Martine Lenders 2016-01-26 19:12:41 +01:00
commit d38a9db966
2 changed files with 12 additions and 2 deletions

View File

@ -30,6 +30,15 @@
extern "C" { extern "C" {
#endif #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. * @brief A Semaphore.
*/ */
@ -39,7 +48,7 @@ typedef struct {
} sema_t; } sema_t;
/** /**
* @brief Creates semaphore. * @brief Creates semaphore dynamically.
* *
* @see <a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/sem_init.html"> * @see <a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/sem_init.html">
* The Open Group Base Specifications Issue 7, sem_init() * 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. * @param[in] sema A semaphore.
* *
* @return 0, on success
* @return -EINVAL, if semaphore is invalid. * @return -EINVAL, if semaphore is invalid.
* @return -EOVERFLOW, if the semaphore's value would overflow. * @return -EOVERFLOW, if the semaphore's value would overflow.
*/ */

View File

@ -173,7 +173,7 @@ int sema_post(sema_t *sema)
restoreIRQ(old_state); restoreIRQ(old_state);
} }
return 1; return 0;
} }
/** @} */ /** @} */