git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@31540 fb15a70f-31f2-0310-bbcc...
[cake.git] / test / childwait.c
blobe4710725ac77268d5cca62753aabd2c101a85beb
1 #include <proto/exec.h>
2 #include <dos/dosextens.h>
3 #include <proto/dos.h>
5 LONG entry()
7 Delay(50);
8 return 0;
11 int main()
13 struct Process *child;
15 struct TagItem tags[] =
17 { NP_Entry, (IPTR) entry },
18 { NP_Cli, (IPTR) TRUE },
19 { NP_Name, (IPTR) "test" },
20 { NP_NotifyOnDeath, (IPTR) TRUE },
21 { TAG_DONE, 0 }
24 child = CreateNewProc(tags);
26 if(child)
28 ULONG childid = GetETask((struct Task*) child)->et_UniqueID;
29 Printf("Waiting for child with id %d\n", childid);
30 ChildWait(childid);
31 Printf("Child exited, freeing child\n");
32 ChildFree(childid);
34 else
35 PrintFault(IoErr(), "Couldn't create child process");
36 return 0;