Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!kuhub.cc.ukans.edu!markv From: markv@kuhub.cc.ukans.edu Newsgroups: comp.sys.amiga.programmer Subject: Re: usage of CreateProcess() ?? Message-ID: <1991Apr25.144702.30033@kuhub.cc.ukans.edu> Date: 25 Apr 91 14:47:02 CDT References: <11388@uwm.edu> Organization: University of Kansas Academic Computing Services Lines: 100 In article <11388@uwm.edu>, plonka@carroll1.cc.edu (Dave Plonka) writes: > > I need some help with either CreateTask() or CreateProcess(). > > At present, I'm trying to use CreateTask() as documented in the ROM Kernal > Libraries & Devices Manual. However, my routine needs to communicate with > devices (serial and narrator). Does my routine then need to be a process > since it calls library or device functions even if I open the disk-based > libraries in the parent process? No. The only reason you need to be a Process to OpenLibrary() is if you have to worry about going to disk to load the library. If the parent has put the library in memory and you know its there (ie: its holding it open). In most cases, a child can even use a Lib base given to it by its parent, except things like the mathieeexxxx libraries, which keep track of information on a task by task basis. > I have no documentation on the CreateProcess() function since it is not > in either "Libraries & Devices" or "Includes & Autodocs". Accoding to the > RKM CreateProc() is in the dos.library. Yes it is, it is called off of DOSBase. > Could someone could provide me with at least the detailed parameter list for > CreateProc()? That should give me a place to start. > Okay, CreateProc()'s prototype looks like this: struct MsgPort *CreateProc(char *Name, LONG Priority, BPTR SegList, LONG StackSize); Stack size is the size of the stack, Name is a CPTR to a C (null term) string (not a BPTR to a BSTR), and Priority is the priority (-127 to +127) of the process. SegList is the tricky parameter. It is either a BPTR returned by LoadSeg() (used to load external program), ie: BPTR LoadSeg(char *ExternalProgramName); or, if you want to use your own code in memory, you need to dummy a seglist like this: SegBase: DS.L 0 DC.L 16 DC.L 0 CodeStart: #Code starts here. And then convert SegBase to a BPTR ie: Foo = CreateProc("MyProc", 0L, BADDR(SegBase), 4096L); Note in general a "dummy" Seglist requires at least at bit of assembler since there is no way with C to get the data of the SegList in front of your code otherwise. > I may be going at this all wrong however. I want to have two tasks, for > simultaneous reading & writing to the serial port. Associated with each of > these tasks is their own window processing to handle gadgets for either the > receive or transmit functions in the task body. Note that for your specific example, you dont need to have a process. > I guess I'd like to know what advantage, if any, CreateProc() would provide. Well, if later on you wish to use DOS services directly then you have to have a process, otherwise there is no need/advantage. Note that processes are like tasks in that once you CreateXXX() them, they are running on their own, so you have to be careful to kill/exit them properly. Note that 2.0 has a CreateNewProc() function that should be used instead. It is a lot more flexible (you can specify a console window, etc to use), and it can take a straight function pointer or a seglist, you can "roll your own" process in straight C. It works off a general tag list, which is its only "true" parameter. > Dave > Please reply via email to the address below. Ooops, oh well... > ----------------------------------------------- > plonka@carroll1.cc.edu Dave Plonka > ARS: N9HZF > ----------------------------------------------- -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Mark Gooderum Only... \ Good Cheer !!! Academic Computing Services /// \___________________________ University of Kansas /// /| __ _ Bix: mgooderum \\\ /// /__| |\/| | | _ /_\ makes it Bitnet: MARKV@UKANVAX \/\/ / | | | | |__| / \ possible... Internet: markv@kuhub.cc.ukans.edu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~