2 Copyright © 1995-2002, The AROS Development Team. All rights reserved.
6 #include <proto/exec.h>
7 #include <exec/ports.h>
9 #include <exec/memory.h>
10 #include <exec/tasks.h>
11 #include <clib/exec_protos.h>
15 #define STACKSIZE 4096
17 static void entry(void)
19 struct MsgPort
*port1
,*port2
;
23 port1
=FindPort("message test port");
26 port2
=CreateMsgPort();
29 msg
=(struct Message
*)CreateIORequest(port2
,sizeof(struct Message
));
35 msg
->mn_Node
.ln_Name
=(char *)(IPTR
)i
;
40 DeleteIORequest((struct IORequest
*)msg
);
45 Signal(port1
->mp_SigTask
,1<<port1
->mp_SigBit
);
47 Wait(0);/* Let the parent remove me */
50 int main(int argc
, char* argv
[])
52 struct MsgPort
*port1
;
55 port1
=CreateMsgPort();
58 port1
->mp_Node
.ln_Name
="message test port";
61 if(FindPort(port1
->mp_Node
.ln_Name
)==NULL
)
66 t
=(struct Task
*)AllocMem(sizeof(struct Task
), MEMF_PUBLIC
|MEMF_CLEAR
);
70 s
=(UBYTE
*)AllocMem(STACKSIZE
, MEMF_PUBLIC
|MEMF_CLEAR
);
73 t
->tc_Node
.ln_Type
=NT_TASK
;
75 t
->tc_Node
.ln_Name
="new task";
77 t
->tc_SPUpper
=s
+STACKSIZE
;
78 #if AROS_STACK_GROWS_DOWNWARDS
79 t
->tc_SPReg
=(UBYTE
*)t
->tc_SPUpper
-SP_OFFSET
;
81 t
->tc_SPReg
=(UBYTE
*)t
->tc_SPLower
-SP_OFFSET
;
83 NEWLIST(&t
->tc_MemEntry
);
84 AddTask(t
,&entry
,NULL
);
86 Wait(1<<port1
->mp_SigBit
);
87 if(port1
->mp_MsgList
.lh_Head
->ln_Succ
!=NULL
)
96 printf("%d\n",(int)(IPTR
)msg
->mn_Node
.ln_Name
);
100 Wait(1<<port1
->mp_SigBit
);
103 FreeMem(s
,STACKSIZE
);
105 FreeMem(t
,sizeof(struct Task
));
110 DeleteMsgPort(port1
);