Changeset 063a74b9 in mainline
- Timestamp:
- 2013-09-07T22:17:45Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7de18418
- Parents:
- a74d0ad
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/futex.c
ra74d0ad r063a74b9 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.