home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / sys / amiga / programm / 16077 < prev    next >
Encoding:
Text File  |  1992-11-19  |  2.9 KB  |  58 lines

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