home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.amiga.programmer
- Path: sparky!uunet!gatech!concert!samba!usenet
- From: Todd_Lewis@unc.edu (Todd M. Lewis)
- Subject: Re: Subtasks, IEEE library pointers - y.a.Q
- Message-ID: <1992Nov19.150345.19491@samba.oit.unc.edu>
- Sender: usenet@samba.oit.unc.edu
- Nntp-Posting-Host: guitar.oit.unc.edu
- Organization: UNC Office of Information Technology
- References: <jbickers.0iey@templar.actrix.gen.nz>
- Date: Thu, 19 Nov 1992 15:03:45 GMT
- Lines: 45
-
- In article <jbickers.0iey@templar.actrix.gen.nz> jbickers@templar.actrix.gen.nz
- (John Bickers) writes:
- >Quoted from <36848@cbmvax.commodore.com> by dlarson@cbmvax.commodore.com (Dale
- Larson - Product Assurance):
- >> 1) Other libraries exist now, other than the math libraries, which are
- >> documented as absolutely not allowing the sharing of library bases beteween
- > Is there a list of these somewhere? This looks like good info to
- > put in a FAQ (ie: what libraries to avoid like the plague :).
-
- Let's keep things in perspective here. While it is true that some libraries
- with side effects cannot be used by subtasks, and these new guidelines
- on sharing library bases make some of the amiga.lib task and process
- functions TOTALLY USELESS (shouting intentional here), there usually is
- a reasonable compromise. Let me outline how I'm working around the
- problem (a problem which I evidently have not been able to effectively
- communicate to the otherwise clever network).
-
- Problem: Library base pointer variables must be shared for any but the
- most trivial subtasks. Fortunately, libraries that are commonly used
- by subtasks are "clean" (intuition and graphics) in that they have no
- untoward side effects on the opening tasks, and OpenLibrary() always
- returns the same base address.
-
- Now when I spin off subtasks, I have the subtask do "tmp=OpenLibrary()",
- then compare tmp with the library base pointer (IntuitionBase, for
- example). If IntuitionBase is NULL, I store tmp there and go on. If it
- isn't NULL but is the same as tmp, all is cool and I go on. However, if it
- isn't NULL and it isn't equal to tmp, then I've got different library
- bases and there is no reasonable way to write subtasks that handle
- that, so I CloseLibrary(tmp) and abort.
-
- This way in the future when/if these well-behavied libraries grow
- side effects I can at least die gracefully, and in the mean time
- I can spin off subtasks to my heart's content.
-
- So what good is CreateTask() if the created tasks can't call libraries?
- Rare is the case when I spin off a function as a single subtask--I usually
- spin off anywhere from several to hundreds of subtasks. The current
- C compilers just won't let you use libraries in these tasks without
- using the same base pointers for the libraries.
- ---
- Todd M. Lewis / Todd_Lewis@unc.edu / utoddl@guitar.oit.unc.edu
- Another Month Ends / All Targets Met / All Systems Working / All customers
- Satisfied / All Staff Eager and Enthusiastic / All Pigs Fed and Ready to Fly
-
-