James E. King III
2018-11-25 14:01:10 UTC
I have isolated a problem in pthread_cond_timedwait when the condattr
is used to set the clock type to CLOCK_MONOTONIC. In this case even
though a target time point in the future is specified, the call
returns ETIMEDOUT but a subsequent call to
clock_gettime(CLOCK_MONOTONIC) shows the desired time point was not
reached.
$ gcc timed_wait_short.c -o timed_wait_short
$ ./timed_wait_short.exe
begin: 521036s 122315900n
target: 521036s 172315900n
end: 521036s 173293100n
ok: true
begin: 521036s 174872400n
target: 521036s 224872400n
end: 521036s 224378900n
ok: false
***@pulsar /cygdrive/c/users/jim/desktop
$ ./timed_wait_short.exe
begin: 521052s 95953200n
target: 521052s 145953200n
end: 521052s 145284000n
ok: false
***@pulsar /cygdrive/c/users/jim/desktop
$ ./timed_wait_short.exe
begin: 521056s 396277200n
target: 521056s 446277200n
end: 521056s 446664700n
ok: true
begin: 521056s 454535100n
target: 521056s 504535100n
end: 521056s 504567000n
ok: true
begin: 521056s 510360800n
target: 521056s 560360800n
end: 521056s 560555600n
ok: true
begin: 521056s 566604400n
target: 521056s 616604400n
end: 521056s 616622800n
ok: true
begin: 521056s 619277800n
target: 521056s 669277800n
end: 521056s 669646400n
ok: true
begin: 521056s 671907500n
target: 521056s 721907500n
end: 521056s 721578000n
ok: false
I have attached the source code.
Cygwin DLL version info:
DLL version: 2.11.2
DLL epoch: 19
DLL old termios: 5
DLL malloc env: 28
Cygwin conv: 181
API major: 0
API minor: 329
Shared data: 5
DLL identifier: cygwin1
Mount registry: 3
Cygwin registry name: Cygwin
Installations name: Installations
Cygdrive default prefix:
Build date:
Shared id: cygwin1S5
is used to set the clock type to CLOCK_MONOTONIC. In this case even
though a target time point in the future is specified, the call
returns ETIMEDOUT but a subsequent call to
clock_gettime(CLOCK_MONOTONIC) shows the desired time point was not
reached.
$ gcc timed_wait_short.c -o timed_wait_short
$ ./timed_wait_short.exe
begin: 521036s 122315900n
target: 521036s 172315900n
end: 521036s 173293100n
ok: true
begin: 521036s 174872400n
target: 521036s 224872400n
end: 521036s 224378900n
ok: false
***@pulsar /cygdrive/c/users/jim/desktop
$ ./timed_wait_short.exe
begin: 521052s 95953200n
target: 521052s 145953200n
end: 521052s 145284000n
ok: false
***@pulsar /cygdrive/c/users/jim/desktop
$ ./timed_wait_short.exe
begin: 521056s 396277200n
target: 521056s 446277200n
end: 521056s 446664700n
ok: true
begin: 521056s 454535100n
target: 521056s 504535100n
end: 521056s 504567000n
ok: true
begin: 521056s 510360800n
target: 521056s 560360800n
end: 521056s 560555600n
ok: true
begin: 521056s 566604400n
target: 521056s 616604400n
end: 521056s 616622800n
ok: true
begin: 521056s 619277800n
target: 521056s 669277800n
end: 521056s 669646400n
ok: true
begin: 521056s 671907500n
target: 521056s 721907500n
end: 521056s 721578000n
ok: false
I have attached the source code.
Cygwin DLL version info:
DLL version: 2.11.2
DLL epoch: 19
DLL old termios: 5
DLL malloc env: 28
Cygwin conv: 181
API major: 0
API minor: 329
Shared data: 5
DLL identifier: cygwin1
Mount registry: 3
Cygwin registry name: Cygwin
Installations name: Installations
Cygdrive default prefix:
Build date:
Shared id: cygwin1S5