diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2022-02-07 06:57:44 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2022-02-07 06:57:44 +0100 |
commit | 6ffaa52cf732a84c0f8259dbc9b8183960ec5c33 (patch) | |
tree | d3136c22e3e805cfc0efe78412cce905a17e0c8d /tests/test-rwlock1.c | |
parent | 591cbf5878b7d4105b275585b9db1324c9dfce56 (diff) | |
parent | af151c593704a40e10efb28d1e3dd59a23a661f3 (diff) |
Merge branch 'release/debian/1.0-1'debian/1.0-1
Diffstat (limited to 'tests/test-rwlock1.c')
-rw-r--r-- | tests/test-rwlock1.c | 25 |
1 files changed, 19 insertions, 6 deletions
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 <config.h> +#if USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || USE_WINDOWS_THREADS + #include "glthread/lock.h" #include <errno.h> @@ -29,7 +31,6 @@ #include <unistd.h> #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 <stdio.h> + +int +main () +{ + fputs ("Skipping test: multithreading not enabled\n", stderr); + return 77; +} + +#endif |