Changes in uspace/lib/c/include/futex.h [8d2dd7f2:b7fd2a0] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/futex.h
r8d2dd7f2 rb7fd2a0 37 37 38 38 #include <atomic.h> 39 #include <errno.h> 39 40 #include <libc.h> 40 41 … … 107 108 * @param futex Futex. 108 109 * 109 * @return Non-zeroif the futex was acquired.110 * @return Zeroif the futex was not acquired.110 * @return true if the futex was acquired. 111 * @return false if the futex was not acquired. 111 112 * 112 113 */ 113 static inline intfutex_trydown(futex_t *futex)114 static inline bool futex_trydown(futex_t *futex) 114 115 { 115 116 return cas(&futex->val, 1, 0); … … 121 122 * 122 123 * @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. 125 126 * 126 127 */ 127 static inline int futex_down(futex_t *futex)128 static inline errno_t futex_down(futex_t *futex) 128 129 { 129 130 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); 131 132 132 return 0;133 return EOK; 133 134 } 134 135 … … 138 139 * 139 140 * @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. 141 143 * 142 144 */ 143 static inline int futex_up(futex_t *futex)145 static inline errno_t futex_up(futex_t *futex) 144 146 { 145 147 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); 147 149 148 return 0;150 return EOK; 149 151 } 150 152
Note:
See TracChangeset
for help on using the changeset viewer.