summaryrefslogtreecommitdiff
path: root/tests/test-rwlock1.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2022-01-08 11:51:39 +0100
committerJörg Frings-Fürst <debian@jff.email>2022-01-08 11:51:39 +0100
commit2959e59fab3bab834368adefd90bd4b1b094366b (patch)
tree7d0ae09775ea950056193eaa2ca93844299d46f1 /tests/test-rwlock1.c
parentc78359d9542c86b972aac373efcf7bc7a8a560e5 (diff)
parentbe8efac78d067c138ad8dda03df4336e73f94887 (diff)
Update upstream source from tag 'upstream/1.0'
Update to upstream version '1.0' with Debian dir 4875e7dc9f7277205f0086a63ee21ccdb1d54593
Diffstat (limited to 'tests/test-rwlock1.c')
-rw-r--r--tests/test-rwlock1.c25
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