MCPcopy Create free account
hub / github.com/Hamlib/Hamlib / pthread_rwlock_timedrdlock

Function pthread_rwlock_timedrdlock

include/hamlib/winpthreads.h:505–524  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

503}
504
505static int pthread_rwlock_timedrdlock(pthread_rwlock_t *l, const struct timespec *ts)
506{
507 unsigned long long ct = _pthread_time_in_ms();
508 unsigned long long t = _pthread_time_in_ms_from_timespec(ts);
509
510 pthread_testcancel();
511
512 /* Use a busy-loop */
513 while (1)
514 {
515 /* Try to grab lock */
516 if (!pthread_rwlock_tryrdlock(l)) return 0;
517
518 /* Get current time */
519 ct = _pthread_time_in_ms();
520
521 /* Have we waited long enough? */
522 if (ct > t) return ETIMEDOUT;
523 }
524}
525
526static int pthread_rwlock_timedwrlock(pthread_rwlock_t *l, const struct timespec *ts)
527{

Callers

nothing calls this directly

Calls 4

_pthread_time_in_msFunction · 0.85
pthread_testcancelFunction · 0.85
pthread_rwlock_tryrdlockFunction · 0.85

Tested by

no test coverage detected