diff options
author | Wolfgang Hommel <wolfgang.hommel@unibw.de> | 2022-02-20 21:51:28 +0100 |
---|---|---|
committer | Wolfgang Hommel <wolfgang.hommel@unibw.de> | 2022-02-20 21:51:28 +0100 |
commit | 46a0f84c1ec5e2a2f87b67fed3f02de26cb9bf0d (patch) | |
tree | c39e43bc2f874223c56bb2d84bed27df8f9a5dda /src | |
parent | 985d666d7336a3dca5c5348acc4e3db76630f4f4 (diff) | |
download | libfaketime-pthread_cond_clockwait.tar.gz |
Intecept pthread_cond_clockwait (addresses #353)pthread_cond_clockwait
Diffstat (limited to 'src')
-rw-r--r-- | src/libfaketime.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/libfaketime.c b/src/libfaketime.c index 5df3fe8..8133367 100644 --- a/src/libfaketime.c +++ b/src/libfaketime.c @@ -3562,7 +3562,7 @@ int pthread_cond_destroy_232(pthread_cond_t *cond) //where init in pthread methods???? -int pthread_cond_timedwait_common(pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime, ft_lib_compat_pthread compat) +int pthread_cond_timedwait_common(pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime, ft_lib_compat_pthread compat, clockid_t forced_clock_id) { struct timespec tp, tdiff_actual, realtime, faketime; struct timespec *tf = NULL; @@ -3585,6 +3585,11 @@ int pthread_cond_timedwait_common(pthread_cond_t *cond, pthread_mutex_t *mutex, else clk_id = CLOCK_REALTIME; + if (forced_clock_id != -1) + { + clk_id = forced_clock_id; + } + DONT_FAKE_TIME(result = (*real_clock_gettime)(clk_id, &realtime)); if (result == -1) { @@ -3651,12 +3656,17 @@ int pthread_cond_timedwait_common(pthread_cond_t *cond, pthread_mutex_t *mutex, int pthread_cond_timedwait_225(pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime) { - return pthread_cond_timedwait_common(cond, mutex, abstime, FT_COMPAT_GLIBC_2_2_5); + return pthread_cond_timedwait_common(cond, mutex, abstime, FT_COMPAT_GLIBC_2_2_5, -1); } int pthread_cond_timedwait_232(pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime) { - return pthread_cond_timedwait_common(cond, mutex, abstime, FT_COMPAT_GLIBC_2_3_2); + return pthread_cond_timedwait_common(cond, mutex, abstime, FT_COMPAT_GLIBC_2_3_2, -1); +} + +int pthread_cond_clockwait(pthread_cond_t *cond, pthread_mutex_t *mutex, clockid_t clockid, const struct timespec *abstime) +{ + return pthread_cond_timedwait_common(cond, mutex, abstime, FT_COMPAT_GLIBC_2_3_2, clockid); } __asm__(".symver pthread_cond_timedwait_225, pthread_cond_timedwait@GLIBC_2.2.5"); |