From be8efac78d067c138ad8dda03df4336e73f94887 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sat, 8 Jan 2022 11:51:07 +0100 Subject: New upstream version 1.0 --- tests/test-rwlock1.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'tests/test-rwlock1.c') diff --git a/tests/test-rwlock1.c b/tests/test-rwlock1.c index 6b44f232..aebb530c 100644 --- a/tests/test-rwlock1.c +++ b/tests/test-rwlock1.c @@ -1,5 +1,5 @@ /* Test of glthread_rwlock_rdlock function. - Copyright (C) 2017-2018 Free Software Foundation, Inc. + Copyright (C) 2017-2022 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,6 +21,8 @@ #include +#if USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || USE_WINDOWS_THREADS + #include "glthread/lock.h" #include @@ -29,7 +31,6 @@ #include #include "glthread/thread.h" -#include "glthread/yield.h" /* Verify that in a situation where - an rwlock is taken by a reader and has a writer waiting, @@ -48,7 +49,7 @@ POSIX:2008 makes this requirement only for implementations that support TPS (Thread Priority Scheduling) and only for the scheduling policies SCHED_FIFO and SCHED_RR, see - http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_rwlock_rdlock.html + https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_rwlock_rdlock.html but test verifies the guarantee regardless of TPS and regardless of scheduling policy. */ @@ -149,9 +150,21 @@ main () /* Job done. Go to sleep. */ for (;;) { - /* In cooperative threads implementations (Pth), give other threads - a chance to run. */ - gl_thread_yield (); sleep (1); } } + +#else + +/* No multithreading available. */ + +#include + +int +main () +{ + fputs ("Skipping test: multithreading not enabled\n", stderr); + return 77; +} + +#endif -- cgit v1.2.3