libgomp: Don't access gomp_sem_t as int using atomics unconditionally
authorJakub Jelinek <jakub@redhat.com>
Mon, 18 Jan 2021 06:18:46 +0000 (07:18 +0100)
committerJakub Jelinek <jakub@redhat.com>
Mon, 18 Jan 2021 06:18:46 +0000 (07:18 +0100)
commitd3b41bde961713ff4af7e18011126434c497edba
tree72a909a9aa158d38893c15a79b86ac0649849b27
parent994fb69ac1b7d52348e84a021c07b24e285294d0
libgomp: Don't access gomp_sem_t as int using atomics unconditionally

This patch introduces gomp_sem_getcount wrapper, which uses sem_getvalue
for POSIX and atomic loads for linux futex and accel.  rtems for now
remains broken.

2021-01-18  Jakub Jelinek  <jakub@redhat.com>

* config/linux/sem.h (gomp_sem_getcount): New function.
* config/posix/sem.h (gomp_sem_getcount): New function.
* config/posix/sem.c (gomp_sem_getcount): New function.
* config/accel/sem.h (gomp_sem_getcount): New function.
* task.c (task_fulfilled_p): Use gomp_sem_getcount.
(omp_fulfill_event): Likewise.
libgomp/config/accel/sem.h
libgomp/config/linux/sem.h
libgomp/config/posix/sem.c
libgomp/config/posix/sem.h
libgomp/task.c