Commit Graph

4 Commits

Author SHA1 Message Date
Jon Turney 938475f6de
Cygwin: testsuite: Make cancel3 and cancel5 more robust
Despite our efforts, sometimes the async cancellation gets deferred.

Notice this by calling pthread_testcancel(), and then try to work out if
async cancellation was ever successful by checking if all threads ran
for the full expected time, or if some were stopped early.

Also, increase the time we allow for the async cancellation to get
delivered to 30 seconds.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2023-07-18 16:45:25 +01:00
Jon Turney e867f8c3e8
Cygwin: testsuite: Busy-wait in cancel3 and cancel5
These tests async thread cancellation of a thread that doesn't have any
cancellation points.

Unfortunately, since 2b165a45 the async cancellation silently fails when
the thread is inside the kernel function Sleep(), so it just exits
normally after 10 seconds. (See the commentary in pthread::cancel() in
thread.cc, where it checks if the target thread is inside the kernel,
and silently converts the cancellation into a deferred one)

Work around this by busy-waiting rather than Sleep()ing for 10 seconds.

This is still somewhat fragile: the async cancel could still fail, if it
happens to occur while we're inside the kernel function that time()
calls.

v2:
Do nothing more efficiently

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2023-07-14 14:02:45 +01:00
Jon Turney 52983af631
Cygwin: testsuite: 64-bit fixes in pthread testcases
Fix warnings and 64-bit issues in pthread testcases.

See pthread-win32 commit 1183e5ac etc.
2023-01-13 17:03:55 +00:00
Egor Duda 8dcdae34b3 * winsup.api/pthread/cancel1.c: New test. Port from pthreads-win32
project.
* winsup.api/pthread/cancel2.c: Ditto.
* winsup.api/pthread/cancel3.c: Ditto.
* winsup.api/pthread/cancel4.c: Ditto.
* winsup.api/pthread/cancel5.c: Ditto.
2002-07-04 15:18:35 +00:00