Changeset 132ab5d1 in mainline for uspace/lib/c/include/futex.h


Ignore:
Timestamp:
2018-01-30T03:20:45Z (7 years ago)
Author:
Jenda <jenda.jzqk73@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5a6cc679
Parents:
8bfb163 (diff), 6a5d05b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge commit '6a5d05bd2551e64111bea4f9332dd7448c26ce84' into forwardport

Separate return value from error code in gen_irq_code*().

File:
1 edited

Legend:

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

    r8bfb163 r132ab5d1  
    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 */
     
    128129{
    129130        if ((atomic_signed_t) atomic_predec(&futex->val) < 0)
    130                 return __SYSCALL1(SYS_FUTEX_SLEEP, (sysarg_t) &futex->val.count);
     131                return (int) __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 */
     
    144146{
    145147        if ((atomic_signed_t) atomic_postinc(&futex->val) < 0)
    146                 return __SYSCALL1(SYS_FUTEX_WAKEUP, (sysarg_t) &futex->val.count);
     148                return (int) __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.