diff options
author | davidxu <davidxu@FreeBSD.org> | 2012-01-16 06:15:14 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2012-01-16 06:15:14 +0000 |
commit | 8c9cfa24de66dab31dbbfa02c62ec9e59ca23154 (patch) | |
tree | 70dfbacc2a1965484fe6fbb8737bb28f2446c999 /lib/libc/gen | |
parent | b77656256dd94f765cbcdf9cd37c4db48e81909b (diff) | |
download | FreeBSD-src-8c9cfa24de66dab31dbbfa02c62ec9e59ca23154.zip FreeBSD-src-8c9cfa24de66dab31dbbfa02c62ec9e59ca23154.tar.gz |
Insert read memory barriers.
Diffstat (limited to 'lib/libc/gen')
-rw-r--r-- | lib/libc/gen/sem.c | 2 | ||||
-rw-r--r-- | lib/libc/gen/sem_new.c | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/libc/gen/sem.c b/lib/libc/gen/sem.c index e9ae669..842298f 100644 --- a/lib/libc/gen/sem.c +++ b/lib/libc/gen/sem.c @@ -434,7 +434,7 @@ _libc_sem_post_compat(sem_t *sem) return ksem_post((*sem)->semid); atomic_add_rel_int(&(*sem)->count, 1); - + rmb(); if ((*sem)->nwaiters) return _umtx_wake(&(*sem)->count); return (0); diff --git a/lib/libc/gen/sem_new.c b/lib/libc/gen/sem_new.c index 2698b40..1480afb 100644 --- a/lib/libc/gen/sem_new.c +++ b/lib/libc/gen/sem_new.c @@ -332,6 +332,7 @@ _sem_getvalue(sem_t * __restrict sem, int * __restrict sval) static __inline int usem_wake(struct _usem *sem) { + rmb(); if (!sem->_has_waiters) return (0); return _umtx_op(sem, UMTX_OP_SEM_WAKE, 0, NULL, NULL); |