Update release-README after completing the 2.43 release.
[binutils-gdb.git] / sim / testsuite / cris / c / thread4.c
blob0df5fba5bf90b83facac1ad1248c17cbf7293757
1 /* Compiler options:
2 #progos: linux
3 #cc: additional_flags=-pthread
4 #output: abb ok\n
6 Testing a pthread corner case. Output will change with glibc
7 releases. */
9 #include <stddef.h>
10 #include <stdio.h>
11 #include <unistd.h>
12 #include <pthread.h>
13 #include <stdlib.h>
15 static void *
16 process (void *arg)
18 int i;
20 if (pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL) != 0)
21 abort ();
22 write (2, "a", 1);
23 for (i = 0; i < 10; i++)
25 sched_yield ();
26 pthread_testcancel ();
27 write (2, "b", 1);
29 return NULL;
32 int
33 main (void)
35 int retcode;
36 pthread_t th_a;
37 void *retval;
39 retcode = pthread_create (&th_a, NULL, process, NULL);
40 sched_yield ();
41 sched_yield ();
42 sched_yield ();
43 sched_yield ();
44 retcode = pthread_cancel (th_a);
45 retcode = pthread_join (th_a, &retval);
46 if (retcode != 0)
47 abort ();
48 fprintf (stderr, " ok\n");
49 return 0;