• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 #include <pthread.h>
3 #include <stdio.h>
4 #include <errno.h>
5 #include <string.h>
6 
7 
thr2(void * v)8 void* thr2 ( void* v )
9 {
10   FILE* f = fopen("bogus2", "r");
11   printf("f  = %ld, errno  = %d (%s)\n", (long)f, errno, strerror(errno));
12   return NULL;
13 }
14 
thr3(void * v)15 void* thr3 ( void* v )
16 {
17   FILE* f = fopen("bogus3", "r");
18   printf("f  = %ld, errno  = %d (%s)\n", (long)f, errno, strerror(errno));
19   return NULL;
20 }
21 
22 
main(void)23 int main ( void )
24 {
25   FILE* f;
26   pthread_t tid2, tid3;
27   pthread_create(&tid2, NULL, &thr2, NULL);
28   pthread_create(&tid3, NULL, &thr3, NULL);
29   f = fopen("bogus", "r");
30   printf("f  = %ld, errno  = %d (%s)\n", (long)f, errno, strerror(errno));
31   pthread_join(tid2, NULL);
32   pthread_join(tid3, NULL);
33   return 0;
34 }
35 
36