mirror of
https://github.com/uroni/urbackup_backend.git
synced 2025-10-26 11:36:50 +00:00
Fix waiting in condition
This commit is contained in:
parent
13dc92b9ed
commit
bb18941f55
@ -55,7 +55,12 @@ void CCondition::wait(IScopedLock *lock, int timems)
|
||||
gettimeofday(&tp, NULL);
|
||||
timespec t;
|
||||
t.tv_sec=tp.tv_sec+timems/(int)1000;
|
||||
t.tv_nsec=tp.tv_usec+(timems%1000)*1000000;
|
||||
t.tv_nsec=(tp.tv_usec+1000*(timems%1000))*1000;
|
||||
while(t.tv_nsec>1000*1000*1000)
|
||||
{
|
||||
++t.tv_sec;
|
||||
t.tv_nsec-=1000*1000*1000;
|
||||
}
|
||||
pthread_cond_timedwait(&cond, ptmutex, &t);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user