Article View: comp.sys.amiga.tech
Article #6443Re: Children and message ports
From: markv
Date: Thu, 08 Nov 1990 16:07
Date: Thu, 08 Nov 1990 16:07
69 lines
2765 bytes
2765 bytes
> I have created a child process using CreateProc. In the child I call
> FindTask to find my task (process) pointer. I then wait on my process
> message port
>
> proc = (struct Process *)FindTask(0);
> port = proc->pr_MsgPort;
> WaitPort(proc);
>
> In the parent I send a message to the child.
>
> procid = CreateProc(name,pri,seg,stack);
> PutMsg(procid,msg);
>
> The result, Task held ...
>
> The eventual guru is 8700004 (not sure on the # of 0). I think this means
> bad packet to the dos library. Does it? How did I do that?
>
> I have commented out the PutMsg to see if that was the problem. It is.
> what is wrong with my PutMsg? Did I miss something?
Your process message port (pr_MsgPort) is not yours to play with, it
belongs to DOS. DOS uses it to send DOSPackets back and forth for
your process' file IO. A non-Handler task should never play with its
process message port. When you send your message, DOS tries to
interpret it as a DOS packet. Sooo...
Try creating your own port and sending to it... like: (off the top of
my head, all parameters not guarenteed correct.)
child:
struct MsgPort *FooPort;
FooPort = CreatePort("APORTNAME", 0);
WaitPort(FooPort);
...etc...
when done...
DeletePort(FooPort);
parent:
struct MsgPort *Foo2Port=NULL;
...CreateProc(...)
while (Foo2Port == NULL) {
Foo2Port = FindPort("APORTNAME");
WaitTOF(); /* Dont busy wait, check 30 times p/sec */
WaitTOF();
}
PutMsg(Foo2Port, AMessage);
Note that this code is extremely simplified. The loop around
FindPort() wouldn't be needed if the child could notify a parent with
a signal or message to a MsgPort of the parent. CreatePort() might
fail too.
> By the way the child task is running.
>
> Please reply by email, post, homing pigeon, any way you can! Thanks
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mark Gooderum Only... \ Good Cheer !!!
Academic Computing Services /// \___________________________
University of Kansas /// /| __ _
Bix: markgood \\\ /// /__| |\/| | | _ /_\ makes it
Bitnet: MARKV@UKANVAX \/\/ / | | | | |__| / \ possible...
Internet: markv@kuhub.cc.ukans.edu
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Technical Details
Message-ID:
<26629.27393c74@kuhub.cc.ukans.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!kuhub.cc.ukans.edu!markvReferences:
<9011021641.AA18389@luke.eecs.wsu.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!kuhub.cc.ukans.edu!markv From: markv@kuhub.cc.ukans.edu Newsgroups: comp.sys.amiga.tech Subject: Re: Children and message ports Message-ID: <26629.27393c74@kuhub.cc.ukans.edu> Date: 8 Nov 90 16:07:32 GMT References: <9011021641.AA18389@luke.eecs.wsu.edu> Organization: University of Kansas Academic Computing Services Lines: 69