Ticket #1596: test.c

File test.c, 419 bytes (added by jackburton, 16 years ago)
Line 
1
2static int32
3foo_thread(void *arg)
4{
5 sleep(2000000);
6 send_signal((uint32)arg, SIGINT);
7}
8
9
10int main()
11{
12 sem_id sem = create_sem(0, "foo sem");
13 thread_id threadId = spawn_kernel_thread(foo_thread, "foo", B_NORMAL_PRIORITY, (void *)find_thread(NULL));
14 if (threadId >= B_OK)
15 resume_thread(threadId);
16
17 // will block
18 acquire_sem_etc(sem, 1, B_CAN_INTERRUPT, B_INFINITE_TIMEOUT);
19
20 // Will we ever get here ?
21}
22
23
24