git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@31540 fb15a70f-31f2-0310-bbcc...
[cake.git] / test / aroscprivdata.c
blobebc07db6c2b8dd209e0993dbf0580dcc9ada34eb
1 #include <proto/dos.h>
2 #include <proto/exec.h>
3 #include <dos/bptr.h>
4 #include <dos/dos.h>
5 #include <string.h>
6 #include <stdlib.h>
7 #include <stdio.h>
8 #include "../rom/exec/etask.h"
10 struct userdata
12 struct Task *parent;
15 void showuserdata(struct Task *this, struct Task *parent)
17 struct arosc_privdata *acpd = NULL;
18 acpd = GetIntETask(this)->iet_acpd;
19 printf("Task %p acpd: %p\n", this, acpd);
21 if(acpd == NULL)
23 printf("acpd is NULL, trying it in parent\n");
24 if (parent)
26 acpd = GetIntETask(parent)->iet_acpd;
27 printf("Parent %p acpd: %p\n", parent, acpd);
32 LONG secondchild()
34 struct Task *parent;
35 struct Task *this;
37 printf("Grandchild\n");
38 this = FindTask(0);
39 parent = ((struct userdata*)this->tc_UserData)->parent;
40 showuserdata(this, parent);
41 Forbid();
42 Signal(parent, SIGBREAKF_CTRL_F);
45 LONG firstchild()
47 struct Task *parent;
48 struct Task *this;
49 struct Process *proc = NULL;
50 struct userdata taskdata;
52 printf("Child\n");
53 this = FindTask(0);
54 parent = ((struct userdata*)this->tc_UserData)->parent;
55 showuserdata(this, parent);
57 taskdata.parent = this;
59 proc = CreateNewProcTags(
60 NP_Entry, secondchild,
61 NP_Name, "Ikari Shinji",
62 NP_UserData, &taskdata,
63 TAG_DONE);
65 if ( proc != NULL ) {
66 Wait(SIGBREAKF_CTRL_F);
69 Forbid();
70 Signal(parent, SIGBREAKF_CTRL_F);
73 int main(int argc, char ** argv)
75 struct Process *proc = NULL;
76 struct userdata taskdata;
77 struct Task *thisTask = FindTask(0);
78 taskdata.parent = thisTask;
80 proc = CreateNewProcTags(
81 NP_Entry, firstchild,
82 NP_Name, "Ayanami Rei",
83 NP_UserData, &taskdata,
84 TAG_DONE);
86 if ( proc != NULL ) {
87 Wait(SIGBREAKF_CTRL_F);