2 Copyright © 2007-2014, The AROS Development Team. All rights reserved.
11 void *thread_func1( void *vptr_args
);
12 void *thread_func2( void *vptr_args
);
20 pthread_t thread1
, thread2
;
22 pthread_create( &thread1
, NULL
, &thread_func1
, NULL
);
23 printf("thread 1 created.. thread: %d\n", thread1
);
25 pthread_create( &thread2
, NULL
, &thread_func2
, NULL
);
26 printf("thread 2 created.. thread: %d\n", thread2
);
29 for( j
= 0; j
< 20; ++j
)
33 for( m
= 99999999; m
; --m
); /* use some CPU time */
35 printf("trying to cancel thread 1\n");
36 pthread_cancel( thread1
);
40 printf("join thread 2\n");
41 pthread_join( thread2
, NULL
);
43 printf("finished!\n");
50 void *thread_func1( void *vptr_args
)
54 for( j
= 0; j
< 20; ++j
)
58 for( f1
= 99999999; f1
; --f1
); /* use some CPU time */
61 printf("func1 end\n");
65 void *thread_func2( void *vptr_args
)
69 for( j
= 0; j
< 20; ++j
)
73 for( f2
= 199999999; f2
; --f2
); /* use some CPU time */
76 printf("func2 end\n");