mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-13 10:52:56 +01:00
Merge pull request #3974 from somdoron/pthread_cond_timedwait
problem: pthread_cond_timedwait sometimes fail with EINVAL
This commit is contained in:
commit
c8e3dfca90
@ -259,13 +259,14 @@ class condition_variable_t
|
|||||||
timeout.tv_sec = 0;
|
timeout.tv_sec = 0;
|
||||||
timeout.tv_nsec = 0;
|
timeout.tv_nsec = 0;
|
||||||
#else
|
#else
|
||||||
clock_gettime (CLOCK_MONOTONIC, &timeout);
|
rc = clock_gettime (CLOCK_MONOTONIC, &timeout);
|
||||||
|
posix_assert (rc);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
timeout.tv_sec += timeout_ / 1000;
|
timeout.tv_sec += timeout_ / 1000;
|
||||||
timeout.tv_nsec += (timeout_ % 1000) * 1000000;
|
timeout.tv_nsec += (timeout_ % 1000) * 1000000;
|
||||||
|
|
||||||
if (timeout.tv_nsec > 1000000000) {
|
if (timeout.tv_nsec >= 1000000000) {
|
||||||
timeout.tv_sec++;
|
timeout.tv_sec++;
|
||||||
timeout.tv_nsec -= 1000000000;
|
timeout.tv_nsec -= 1000000000;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user