🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #1605

Re: fork() (not forkv()!) on Amiga?

#1605
From: Randell Jesup
Date: Wed, 11 Oct 1989 04:34
44 lines
2528 bytes
In article <13920001@hpfelg.HP.COM> koren@hpfelg.HP.COM (Steve Koren) writes:
>I am trying to accomplish what fork() does in UNIX.  Lattice provides
>forkv(), but that is not at all the same thing and won't really meet
>my needs.  I need to be able to say something like this:
>
>      if (fork()) {
>         /* process 1 */
>      } else {
>         /* process 2 */
>      }

	Exact unix semantics are hard at best to achieve, due to the assumption
by unix of seperate address spaces.  Spawning a subroutine as a process can
be done, but be warned that it will share all you global variables, and you
DON'T want to exit before it does.

>I have found that FindTask(0) will return a pointer to a structure
>that contains the address of the segment list.  I tried passing that
>into CreateProc() like this:
>
>     CreateProc("MY_PROC", 0, p->pr_SegList, 5000);
>       (from memory - may not be exact!)

	Not good.  Your startup code (from the compiler) assumes that it is
either being started by CLI/shell or by WB.  CreateProc is neither.  You can
build a seglist that includes a jump to the routine you want to execute.

>I'm trying to put the console device in a RAW mode, such that I can
>read single characters from it without waiting for a newline.  I can
>turn off buffering in Lattice, but it still waits for a newline.
>I know that in Manx there is an stty() call; is there anything like that
>in Lattice?  I know I can read characters via IntuiMessage events, but
>it's important that I do it through the console device.  I can't find
>anything about this in the Lattice manuals, other than the function
>to turn off buffering.

	Console device or console handler?  They are different.  There is
a packet that you can send to the console handler that changes it into
raw mode.  Code for this can be found on the fish disks.

-- 
Randell Jesup, Keeper of AmigaDos, Commodore Engineering.
{uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.cbm.commodore.com  BIX: rjesup  
Common phrase heard at Amiga Devcon '89: "It's in there!"
Technical Details
Message-ID: <8142@cbmvax.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!shadooby!ginosko!brutus.cs.uiuc.edu!apple!oliveb!amiga!cbmvax!jesup
References: <13920001@hpfelg.HP.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!shadooby!ginosko!brutus.cs.uiuc.edu!apple!oliveb!amiga!cbmvax!jesup
From: jesup@cbmvax.UUCP (Randell Jesup)
Newsgroups: comp.sys.amiga.tech
Subject: Re: fork() (not forkv()!) on Amiga?
Message-ID: <8142@cbmvax.UUCP>
Date: 11 Oct 89 04:34:14 GMT
References: <13920001@hpfelg.HP.COM>
Reply-To: jesup@cbmvax.UUCP (Randell Jesup)
Organization: Commodore Technology, West Chester, PA
Lines: 44