diff options
author | Ulrich Drepper <drepper@redhat.com> | 2004-12-22 20:10:10 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2004-12-22 20:10:10 +0000 |
commit | a334319f6530564d22e775935d9c91663623a1b4 (patch) | |
tree | b5877475619e4c938e98757d518bb1e9cbead751 /linuxthreads/joinrace.c | |
parent | 0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (diff) | |
download | glibc-a334319f6530564d22e775935d9c91663623a1b4.tar glibc-a334319f6530564d22e775935d9c91663623a1b4.tar.gz glibc-a334319f6530564d22e775935d9c91663623a1b4.tar.bz2 glibc-a334319f6530564d22e775935d9c91663623a1b4.zip |
(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
Diffstat (limited to 'linuxthreads/joinrace.c')
-rw-r--r-- | linuxthreads/joinrace.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/linuxthreads/joinrace.c b/linuxthreads/joinrace.c new file mode 100644 index 0000000000..8e1064c984 --- /dev/null +++ b/linuxthreads/joinrace.c @@ -0,0 +1,48 @@ +/* Test case by Permaine Cheung <pcheung@cygnus.com>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> + +static 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; +} |