From 15109bd4aa7cef49d08ba0c3939b5389a3b90803 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 10 Jun 2000 08:02:29 +0000 Subject: Update. * joinrace.c: New file. --- linuxthreads/ChangeLog | 1 + linuxthreads/joinrace.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 linuxthreads/joinrace.c (limited to 'linuxthreads') diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog index faf2c43df6..88c866c77f 100644 --- a/linuxthreads/ChangeLog +++ b/linuxthreads/ChangeLog @@ -7,6 +7,7 @@ * join.c (pthread_join): Use nonexisting_handle instead of invalid_handle to test for acceptable thread handle. * manager.c (pthread_handle_free): Likewise. + * joinrace.c: New file. Reported by Permaine Cheung . 2000-06-08 Ulrich Drepper diff --git a/linuxthreads/joinrace.c b/linuxthreads/joinrace.c new file mode 100644 index 0000000000..0a00355d59 --- /dev/null +++ b/linuxthreads/joinrace.c @@ -0,0 +1,48 @@ +/* Test case by Permaine Cheung . */ + +#include +#include +#include +#include + +void * +sub1 (void *arg) +{ + /* Nothing. */ + return NULL; +} + +int +main (void) +{ + int istatus; + int policy; + int cnt; + pthread_t thread1; + struct sched_param spresult1, sp1; + + for (cnt = 0; cnt < 100; ++cnt) + { + printf ("Round %d\n", cnt); + + pthread_create (&thread1, NULL, &sub1, NULL); + pthread_join (thread1, NULL); + + istatus = pthread_getschedparam (thread1, &policy, &spresult1); + if (istatus != ESRCH) + { + printf ("pthread_getschedparam returns: %d\n", istatus); + return 1; + } + + sp1.sched_priority = 0; + istatus = pthread_setschedparam (thread1, SCHED_OTHER, &sp1); + if (istatus != ESRCH) + { + printf ("pthread_setschedparam returns: %d\n", istatus); + return 2; + } + } + + return 0; +} -- cgit v1.2.3-65-gdbad