Changeset f4f866c in mainline for uspace/lib/c/generic/futex.c
- Timestamp:
- 2010-04-23T21:42:26Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6c39a907
- Parents:
- 38aaacc2 (diff), 80badbe (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/futex.c
r38aaacc2 rf4f866c 31 31 */ 32 32 /** @file 33 */ 33 */ 34 34 35 35 #include <futex.h> … … 40 40 /** Initialize futex counter. 41 41 * 42 * @param futex Futex. 43 * @param val Initialization value. 42 * @param futex Futex. 43 * @param val Initialization value. 44 * 44 45 */ 45 46 void futex_initialize(futex_t *futex, int val) … … 50 51 /** Try to down the futex. 51 52 * 52 * @param futex Futex. 53 * @return Non-zero if the futex was acquired. 54 * @return Zero if the futex was not acquired. 53 * @param futex Futex. 54 * 55 * @return Non-zero if the futex was acquired. 56 * @return Zero if the futex was not acquired. 57 * 55 58 */ 56 59 int futex_trydown(futex_t *futex) … … 61 64 /** Down the futex. 62 65 * 63 * @param futex Futex. 64 * @return ENOENT if there is no such virtual address. 65 * @return Zero in the uncontended case. 66 * @return Otherwise one of ESYNCH_OK_ATOMIC or ESYNCH_OK_BLOCKED. 66 * @param futex Futex. 67 * 68 * @return ENOENT if there is no such virtual address. 69 * @return Zero in the uncontended case. 70 * @return Otherwise one of ESYNCH_OK_ATOMIC or ESYNCH_OK_BLOCKED. 71 * 67 72 */ 68 73 int futex_down(futex_t *futex) … … 70 75 if ((atomic_signed_t) atomic_predec(futex) < 0) 71 76 return __SYSCALL1(SYS_FUTEX_SLEEP, (sysarg_t) &futex->count); 72 77 73 78 return 0; 74 79 } … … 76 81 /** Up the futex. 77 82 * 78 * @param futex Futex. 79 * @return ENOENT if there is no such virtual address. 80 * @return Zero in the uncontended case. 83 * @param futex Futex. 84 * 85 * @return ENOENT if there is no such virtual address. 86 * @return Zero in the uncontended case. 87 * 81 88 */ 82 89 int futex_up(futex_t *futex) … … 84 91 if ((atomic_signed_t) atomic_postinc(futex) < 0) 85 92 return __SYSCALL1(SYS_FUTEX_WAKEUP, (sysarg_t) &futex->count); 86 93 87 94 return 0; 88 95 }
Note:
See TracChangeset
for help on using the changeset viewer.