about summary refs log tree commit diff
path: root/linuxthreads
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-07-10 20:50:46 +0000
committerUlrich Drepper <drepper@redhat.com>2002-07-10 20:50:46 +0000
commitf4741da2e730191150e4394237716fb29d61845c (patch)
treeb9059f021264b4165202db41a9513ff02bd321da /linuxthreads
parentd880edc43c82a7a9c9b50c3ad932a9bff35a7e39 (diff)
downloadglibc-f4741da2e730191150e4394237716fb29d61845c.tar.gz
glibc-f4741da2e730191150e4394237716fb29d61845c.tar.xz
glibc-f4741da2e730191150e4394237716fb29d61845c.zip
Update.
	* bug-sleep.c: New file.
	* Makefile (tests): Add bug-sleep.
Diffstat (limited to 'linuxthreads')
-rw-r--r--linuxthreads/ChangeLog2
-rw-r--r--linuxthreads/Makefile2
-rw-r--r--linuxthreads/bug-sleep.c34
3 files changed, 37 insertions, 1 deletions
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index 643013288e..de239845ec 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -2,6 +2,8 @@
 
 	* wrapsyscall.c: Add __nanosleep alias.
 	* Versions (GLIBC_2.2.6): Add __nanosleep.
+	* bug-sleep.c: New file.
+	* Makefile (tests): Add bug-sleep.
 
 2002-06-19  Steven Munroe  <sjmunroe@vnet.ibm.com>
 
diff --git a/linuxthreads/Makefile b/linuxthreads/Makefile
index 41432846c7..a44b9bb834 100644
--- a/linuxthreads/Makefile
+++ b/linuxthreads/Makefile
@@ -60,7 +60,7 @@ endif
 librt-tests = ex10 ex11
 tests = ex1 ex2 ex3 ex4 ex5 ex6 ex7 ex8 ex9 $(librt-tests) ex12 ex13 joinrace \
 	tststack $(tests-nodelete-$(have-z-nodelete)) ecmutex ex14 ex15 ex16 \
-	ex17 ex18 tst-cancel tst-context
+	ex17 ex18 tst-cancel tst-context bug-sleep
 test-srcs = tst-signal
 
 ifeq (yes,$(build-shared))
diff --git a/linuxthreads/bug-sleep.c b/linuxthreads/bug-sleep.c
new file mode 100644
index 0000000000..f29a6b73c0
--- /dev/null
+++ b/linuxthreads/bug-sleep.c
@@ -0,0 +1,34 @@
+/* PR libc/4005 */
+#include <pthread.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <time.h>
+
+void *
+run_thread (void *a)
+{
+  while (1)
+    {
+      sleep (10);
+    }
+  return 0;
+}
+
+int
+main (void)
+{
+  pthread_t thr;
+  void *result;
+  alarm (4);
+  printf ("Starting thread.\n");
+  pthread_create (&thr, 0, run_thread, 0);
+  sleep (2);
+  printf ("Canceling thread.\n");
+  pthread_cancel (thr);
+  pthread_join (thr, &result);
+  if (result == PTHREAD_CANCELED)
+    printf ("Thread canceled.\n");
+  else
+    printf ("Thread exited.\n");
+  return 0;
+}