Ticket #1011: thtest.c

File thtest.c, 477 bytes (added by mmu_man, 18 years ago)

wait_for_thread test

Line 
1#include <OS.h>
2#include <stdio.h>
3
4int32 th(void *p)
5{
6 return 0;
7}
8
9int32 thw(void *p)
10{
11 sleep(1);
12 return 0;
13}
14
15int main()
16{
17 status_t err, st;
18 thread_id tid;
19 tid = spawn_thread(th, "th", B_NORMAL_PRIORITY, NULL);
20 resume_thread(tid);
21 err = wait_for_thread(tid, &st);
22 printf("err = %08x st = %08x\n", err, st);
23 tid = spawn_thread(thw, "th", B_NORMAL_PRIORITY, NULL);
24 resume_thread(tid);
25 err = wait_for_thread(tid, &st);
26 printf("err = %08x st = %08x\n", err, st);
27}