Changes in uspace/lib/c/generic/futex.c [063a74b9:9d58539] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/futex.c
r063a74b9 r9d58539 35 35 #include <futex.h> 36 36 #include <atomic.h> 37 #include <libarch/barrier.h>38 37 #include <libc.h> 39 38 #include <sys/types.h> … … 60 59 int futex_trydown(futex_t *futex) 61 60 { 62 int rc; 63 64 rc = cas(futex, 1, 0); 65 CS_ENTER_BARRIER(); 66 67 return rc; 61 return cas(futex, 1, 0); 68 62 } 69 63 … … 79 73 int futex_down(futex_t *futex) 80 74 { 81 atomic_signed_t nv; 82 83 nv = (atomic_signed_t) atomic_predec(futex); 84 CS_ENTER_BARRIER(); 85 if (nv < 0) 75 if ((atomic_signed_t) atomic_predec(futex) < 0) 86 76 return __SYSCALL1(SYS_FUTEX_SLEEP, (sysarg_t) &futex->count); 87 77 … … 99 89 int futex_up(futex_t *futex) 100 90 { 101 CS_LEAVE_BARRIER();102 103 91 if ((atomic_signed_t) atomic_postinc(futex) < 0) 104 92 return __SYSCALL1(SYS_FUTEX_WAKEUP, (sysarg_t) &futex->count);
Note:
See TracChangeset
for help on using the changeset viewer.