diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2022-01-08 11:51:07 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2022-01-08 11:51:07 +0100 |
commit | be8efac78d067c138ad8dda03df4336e73f94887 (patch) | |
tree | 5f5254a628ba0ef72065b93d949d1c985742ea8e /tests/test-rwlock1.c | |
parent | 7b65dbd4ebade81d504cfe5e681292a58ad1fdf0 (diff) |
New upstream version 1.0upstream/1.0
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 6b44f23..aebb530 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 |