Changeset 99c2c69e in mainline for uspace/lib/c/generic/futex.c
- Timestamp:
- 2013-09-13T00:36:30Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 67fbd5e
- Parents:
- 7f84430 (diff), 11d41be5 (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
r7f84430 r99c2c69e 35 35 #include <futex.h> 36 36 #include <atomic.h> 37 #include <libarch/barrier.h> 37 38 #include <libc.h> 38 39 #include <sys/types.h> … … 59 60 int futex_trydown(futex_t *futex) 60 61 { 61 return cas(futex, 1, 0); 62 int rc; 63 64 rc = cas(futex, 1, 0); 65 CS_ENTER_BARRIER(); 66 67 return rc; 62 68 } 63 69 … … 73 79 int futex_down(futex_t *futex) 74 80 { 75 if ((atomic_signed_t) atomic_predec(futex) < 0) 81 atomic_signed_t nv; 82 83 nv = (atomic_signed_t) atomic_predec(futex); 84 CS_ENTER_BARRIER(); 85 if (nv < 0) 76 86 return __SYSCALL1(SYS_FUTEX_SLEEP, (sysarg_t) &futex->count); 77 87 … … 89 99 int futex_up(futex_t *futex) 90 100 { 101 CS_LEAVE_BARRIER(); 102 91 103 if ((atomic_signed_t) atomic_postinc(futex) < 0) 92 104 return __SYSCALL1(SYS_FUTEX_WAKEUP, (sysarg_t) &futex->count);
Note:
See TracChangeset
for help on using the changeset viewer.