Insert read memory barriers.

This commit is contained in:
davidxu 2012-01-16 06:15:14 +00:00
parent b77656256d
commit 8c9cfa24de
2 changed files with 2 additions and 1 deletions

View File

@ -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);

View File

@ -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);