12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- #include <pthread.h>
- #include <signal.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- static void *tf (void *a)
- {
- puts ("start tf");
-
- flockfile (stdout);
- puts ("after first flockfile");
- flockfile (stdout);
- puts ("foo");
- funlockfile (stdout);
- puts ("after first funlockfile");
- funlockfile (stdout);
- puts ("all done");
- return a;
- }
- int
- do_test (void)
- {
- pthread_t th;
- if (pthread_create (&th, NULL, tf, NULL) != 0)
- {
- write (2, "create failed\n", 14);
- _exit (1);
- }
- void *result;
- if (pthread_join (th, &result) != 0)
- {
- puts ("join failed");
- exit (1);
- }
- else if (result != NULL)
- {
- printf ("wrong return value: %p, expected %p\n", result, NULL);
- exit (1);
- }
- puts ("join returned succsefully");
- return 0;
- }
- #define TEST_FUNCTION do_test ()
- #include "../test-skeleton.c"
|