Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!lll-winken!iggy.GW.Vitalink.COM!widener!dsinc!bagate!cbmvax!bj From: bj@cbmvax.commodore.com (Brian Jackson) Newsgroups: comp.sys.amiga.programmer Subject: Re: General questions regarding Tasks Message-ID: <21914@cbmvax.commodore.com> Date: 25 May 91 01:33:59 GMT References: <1991May24.160440.374@m.cs.uiuc.edu> <1991May24.120133.31035@kuhub.cc.ukans.edu> Reply-To: bj@cbmvax.commodore.com (Brian Jackson) Organization: Commodore, West Chester, PA Lines: 46 In article <1991May24.120133.31035@kuhub.cc.ukans.edu> markv@kuhub.cc.ukans.edu writes: >In article <1991May24.160440.374@m.cs.uiuc.edu>, schwager@m.cs.uiuc.edu (Michael Schwager) writes: >> >> Hi, >> I'm looking for guidelines about using tasks within C programs. > ... >> What do I need to be careful of (besides changing system variables)? > >Don't call DOS!!! This also means don't call things like >OpenLibrary() unless you know the library is in memory. Many DOS >functions that used to let you get away with being a task in 1.3 will >barf in 2.0. So don't call DOS or only OpenXXX call that could >require something to be loaded off the disk. If you do need access to >such devices or libs, have the parent open it first to load it, and >hold it open, then when the child opens it, it will be in memory. Yes, and don't call anything that might, in turn, call DOS. Be aware that there are some libraries that want 'task-specific' information and the above trick will be less than optimal in those cases. :) It's really better in this case to just create a new Process instead. Under 1.3 this is a tad arcane (but not really that hard) and under 2.0 it's cake. >> Also, can I pass variables to a Task, like this: >> CreateTask ("Name", 0, func3 (var0, var1, var2), BIGSTACK); Ths easiest way to do this (for me, anyway :)) is to have the child task create a Message Port for such things. That way, you can make up your own data structure in the parent, create the task, fill in the structure with the data that the child needs and then PutMsg() the thing to the child. You pretty much have to do this anyway since there needs to be some mechanism to tell the child "we're going away now." >Mark Gooderum Brian ----------------------------------------------------------------------- / Brian Jackson Software Engineer, Commodore-Amiga Inc. GEnie: B.J. \ \ bj@cbmvax.cbm.commodore.com or ...{uunet|rutgers}!cbmvax!bj / / "Anyone considering the purchase of a high-end Macintosh or IBM- \ \ compatible computer should try an Amiga 3000 for a few hours before / / making the final decision." - Consumer Reports ('91 Buying Guide) \ -------------------------------------------------------------------------