Skip to content

Commit

Permalink
Changed hack for sem_timedwait to avoid changing const timespec
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitSeb committed Oct 9, 2024
1 parent c65c514 commit 7b8a6aa
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/wrapped/wrappedlibpthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,15 @@ EXPORT int my_sem_timedwait(sem_t* sem, struct timespec * t)
}
return sem_timedwait(sem, &t1);
#else
while(t->tv_nsec>=1000000000) {
t->tv_nsec-=1000000000;
t->tv_sec+=1;
if(t->tv_nsec>=1000000000) {
struct timespec t1;
t1.tv_sec=t->tv_sec+1;
t1.tv_nsec=t->tv_nsec-1000000000;
while(t1.tv_nsec>=1000000000) {
t1.tv_nsec-=1000000000;
t1.tv_sec+=1;
}
return sem_timedwait(sem, &t1);
}
return sem_timedwait(sem, t);
#endif
Expand Down

0 comments on commit 7b8a6aa

Please sign in to comment.