mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-05 19:35:52 +03:00
htl: Add sem_clockwait support
* sysdeps/htl/sem-timedwait.c (__sem_timedwait_internal): Add clock_id parameter instead of hardcoding CLOCK_REALTIME. (__sem_clockwait): New function. (sem_clockwait): New weak alias. * sysdeps/htl/sem-wait.c (__sem_timedwait_internal): Update declaration. (__sem_wait): Update call to __sem_timedwait_internal. * htl/Versions (GLIBC_2.32): Add sem_clockwait. * sysdeps/mach/hurd/i386/libpthread.abilist (sem_clockwait): Add symbol. * nptl/Makefile (tests): Move tst-sem5 to... * sysdeps/pthread/Makefile (tests): ... here.
This commit is contained in:
@@ -143,8 +143,8 @@ libpthread {
|
|||||||
pthread_hurd_cond_timedwait_np;
|
pthread_hurd_cond_timedwait_np;
|
||||||
}
|
}
|
||||||
|
|
||||||
# C11 thread symbols.
|
|
||||||
GLIBC_2.32 {
|
GLIBC_2.32 {
|
||||||
|
# C11 thread symbols.
|
||||||
thrd_create; thrd_detach; thrd_exit; thrd_join;
|
thrd_create; thrd_detach; thrd_exit; thrd_join;
|
||||||
mtx_init; mtx_lock; mtx_timedlock; mtx_trylock; mtx_unlock; mtx_destroy;
|
mtx_init; mtx_lock; mtx_timedlock; mtx_trylock; mtx_unlock; mtx_destroy;
|
||||||
call_once;
|
call_once;
|
||||||
@@ -162,6 +162,8 @@ libpthread {
|
|||||||
pthread_rwlock_clockrdlock; pthread_rwlock_clockwrlock;
|
pthread_rwlock_clockrdlock; pthread_rwlock_clockwrlock;
|
||||||
|
|
||||||
pthread_tryjoin_np; pthread_timedjoin_np; pthread_clockjoin_np;
|
pthread_tryjoin_np; pthread_timedjoin_np; pthread_clockjoin_np;
|
||||||
|
|
||||||
|
sem_clockwait;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLIBC_PRIVATE {
|
GLIBC_PRIVATE {
|
||||||
|
@@ -275,7 +275,7 @@ tests = tst-attr2 tst-attr3 tst-default-attr \
|
|||||||
tst-rwlock9 tst-rwlock10 tst-rwlock11 \
|
tst-rwlock9 tst-rwlock10 tst-rwlock11 \
|
||||||
tst-rwlock15 tst-rwlock17 tst-rwlock18 \
|
tst-rwlock15 tst-rwlock17 tst-rwlock18 \
|
||||||
tst-once5 \
|
tst-once5 \
|
||||||
tst-sem5 tst-sem17 \
|
tst-sem17 \
|
||||||
tst-align tst-align3 \
|
tst-align tst-align3 \
|
||||||
tst-kill1 tst-kill2 tst-kill3 tst-kill4 tst-kill5 tst-kill6 \
|
tst-kill1 tst-kill2 tst-kill3 tst-kill4 tst-kill5 tst-kill6 \
|
||||||
tst-raise1 \
|
tst-raise1 \
|
||||||
|
@@ -25,12 +25,12 @@
|
|||||||
|
|
||||||
int
|
int
|
||||||
__sem_timedwait_internal (sem_t *restrict sem,
|
__sem_timedwait_internal (sem_t *restrict sem,
|
||||||
|
clockid_t clock_id,
|
||||||
const struct timespec *restrict timeout)
|
const struct timespec *restrict timeout)
|
||||||
{
|
{
|
||||||
error_t err;
|
error_t err;
|
||||||
int drain;
|
int drain;
|
||||||
struct __pthread *self;
|
struct __pthread *self;
|
||||||
clockid_t clock_id = CLOCK_REALTIME;
|
|
||||||
|
|
||||||
__pthread_spin_wait (&sem->__lock);
|
__pthread_spin_wait (&sem->__lock);
|
||||||
if (sem->__value > 0)
|
if (sem->__value > 0)
|
||||||
@@ -88,10 +88,18 @@ __sem_timedwait_internal (sem_t *restrict sem,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
__sem_clockwait (sem_t *sem, clockid_t clockid,
|
||||||
|
const struct timespec *restrict timeout)
|
||||||
|
{
|
||||||
|
return __sem_timedwait_internal (sem, clockid, timeout);
|
||||||
|
}
|
||||||
|
weak_alias (__sem_clockwait, sem_clockwait);
|
||||||
|
|
||||||
int
|
int
|
||||||
__sem_timedwait (sem_t *restrict sem, const struct timespec *restrict timeout)
|
__sem_timedwait (sem_t *restrict sem, const struct timespec *restrict timeout)
|
||||||
{
|
{
|
||||||
return __sem_timedwait_internal (sem, timeout);
|
return __sem_timedwait_internal (sem, CLOCK_REALTIME, timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
weak_alias (__sem_timedwait, sem_timedwait);
|
weak_alias (__sem_timedwait, sem_timedwait);
|
||||||
|
@@ -20,12 +20,13 @@
|
|||||||
#include <pt-internal.h>
|
#include <pt-internal.h>
|
||||||
|
|
||||||
extern int __sem_timedwait_internal (sem_t *restrict sem,
|
extern int __sem_timedwait_internal (sem_t *restrict sem,
|
||||||
|
clockid_t clockid,
|
||||||
const struct timespec *restrict timeout);
|
const struct timespec *restrict timeout);
|
||||||
|
|
||||||
int
|
int
|
||||||
__sem_wait (sem_t *sem)
|
__sem_wait (sem_t *sem)
|
||||||
{
|
{
|
||||||
return __sem_timedwait_internal (sem, 0);
|
return __sem_timedwait_internal (sem, CLOCK_REALTIME, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
strong_alias (__sem_wait, sem_wait);
|
strong_alias (__sem_wait, sem_wait);
|
||||||
|
@@ -168,6 +168,7 @@ GLIBC_2.32 pthread_rwlock_clockrdlock F
|
|||||||
GLIBC_2.32 pthread_rwlock_clockwrlock F
|
GLIBC_2.32 pthread_rwlock_clockwrlock F
|
||||||
GLIBC_2.32 pthread_timedjoin_np F
|
GLIBC_2.32 pthread_timedjoin_np F
|
||||||
GLIBC_2.32 pthread_tryjoin_np F
|
GLIBC_2.32 pthread_tryjoin_np F
|
||||||
|
GLIBC_2.32 sem_clockwait F
|
||||||
GLIBC_2.32 thrd_create F
|
GLIBC_2.32 thrd_create F
|
||||||
GLIBC_2.32 thrd_detach F
|
GLIBC_2.32 thrd_detach F
|
||||||
GLIBC_2.32 thrd_exit F
|
GLIBC_2.32 thrd_exit F
|
||||||
|
@@ -64,7 +64,7 @@ tests += tst-cnd-basic tst-mtx-trylock tst-cnd-broadcast \
|
|||||||
tst-rwlock1 tst-rwlock4 tst-rwlock5 tst-rwlock12 \
|
tst-rwlock1 tst-rwlock4 tst-rwlock5 tst-rwlock12 \
|
||||||
tst-rwlock13 tst-rwlock14 tst-rwlock16 \
|
tst-rwlock13 tst-rwlock14 tst-rwlock16 \
|
||||||
tst-rwlock-tryrdlock-stall tst-rwlock-trywrlock-stall \
|
tst-rwlock-tryrdlock-stall tst-rwlock-trywrlock-stall \
|
||||||
tst-sem1 tst-sem2 tst-sem3 tst-sem4 tst-sem6 tst-sem7 \
|
tst-sem1 tst-sem2 tst-sem3 tst-sem4 tst-sem5 tst-sem6 tst-sem7 \
|
||||||
tst-sem8 tst-sem9 tst-sem10 tst-sem14 tst-sem15 tst-sem16 \
|
tst-sem8 tst-sem9 tst-sem10 tst-sem14 tst-sem15 tst-sem16 \
|
||||||
tst-spin1 tst-spin2 tst-spin3 tst-spin4 \
|
tst-spin1 tst-spin2 tst-spin3 tst-spin4 \
|
||||||
tst-abstime
|
tst-abstime
|
||||||
|
Reference in New Issue
Block a user