Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/futex.h

    r8d2dd7f2 rb7fd2a0  
    3737
    3838#include <atomic.h>
     39#include <errno.h>
    3940#include <libc.h>
    4041
     
    107108 * @param futex Futex.
    108109 *
    109  * @return Non-zero if the futex was acquired.
    110  * @return Zero if the futex was not acquired.
     110 * @return true if the futex was acquired.
     111 * @return false if the futex was not acquired.
    111112 *
    112113 */
    113 static inline int futex_trydown(futex_t *futex)
     114static inline bool futex_trydown(futex_t *futex)
    114115{
    115116        return cas(&futex->val, 1, 0);
     
    121122 *
    122123 * @return ENOENT if there is no such virtual address.
    123  * @return Zero in the uncontended case.
    124  * @return Otherwise one of ESYNCH_OK_ATOMIC or ESYNCH_OK_BLOCKED.
     124 * @return EOK on success.
     125 * @return Error code from <errno.h> otherwise.
    125126 *
    126127 */
    127 static inline int futex_down(futex_t *futex)
     128static inline errno_t futex_down(futex_t *futex)
    128129{
    129130        if ((atomic_signed_t) atomic_predec(&futex->val) < 0)
    130                 return __SYSCALL1(SYS_FUTEX_SLEEP, (sysarg_t) &futex->val.count);
     131                return (errno_t) __SYSCALL1(SYS_FUTEX_SLEEP, (sysarg_t) &futex->val.count);
    131132       
    132         return 0;
     133        return EOK;
    133134}
    134135
     
    138139 *
    139140 * @return ENOENT if there is no such virtual address.
    140  * @return Zero in the uncontended case.
     141 * @return EOK on success.
     142 * @return Error code from <errno.h> otherwise.
    141143 *
    142144 */
    143 static inline int futex_up(futex_t *futex)
     145static inline errno_t futex_up(futex_t *futex)
    144146{
    145147        if ((atomic_signed_t) atomic_postinc(&futex->val) < 0)
    146                 return __SYSCALL1(SYS_FUTEX_WAKEUP, (sysarg_t) &futex->val.count);
     148                return (errno_t) __SYSCALL1(SYS_FUTEX_WAKEUP, (sysarg_t) &futex->val.count);
    147149       
    148         return 0;
     150        return EOK;
    149151}
    150152
Note: See TracChangeset for help on using the changeset viewer.