1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- #include "test.h"
- static pthread_t handle1;
- static pthread_t handle2;
- static int thread2_status;
- static void *
- thr1(void * arg)
- {
- pte_osThreadSleep(5000);
- return NULL;
- }
- static void *
- thr2(void * arg)
- {
- int result;
- assert(pthread_join(handle1,NULL) == 0);
- thread2_status = 1;
- return NULL;
- }
- int pthread_test_join4()
- {
- thread2_status = 0;
- assert(pthread_create(&handle1, NULL, thr1, NULL) == 0);
- assert(pthread_create(&handle2, NULL, thr2, NULL) == 0);
-
- pte_osThreadSleep(500);
-
- assert(pthread_cancel(handle2) == 0);
-
-
- pte_osThreadSleep(500);
-
- assert(thread2_status == 1);
-
- assert(pthread_join(handle1, NULL) == 0);
- assert(pthread_join(handle2, NULL) == 0);
-
- return 0;
- }
|