home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!oracle!unrepliable!bounce
- Newsgroups: comp.sys.amiga.programmer
- From: dnavas@oracle.uucp (David Navas)
- Subject: Re: How to program multi-threaded programs on Amiga ?
- Message-ID: <1992Nov6.165355.23882@oracle.us.oracle.com>
- Sender: usenet@oracle.us.oracle.com (Oracle News Poster)
- Nntp-Posting-Host: mailseq.us.oracle.com
- Organization: Oracle Corporation, Redwood Shores CA
- References: <36604@cbmvax.commodore.com> <RNlXr*DG7@garfield.fipnet.fi>
- Date: Fri, 6 Nov 1992 16:53:55 GMT
- X-Disclaimer: This message was written by an unauthenticated user
- at Oracle Corporation. The opinions expressed are those
- of the user and not necessarily those of Oracle.
- Lines: 25
-
- In article <RNlXr*DG7@garfield.fipnet.fi> vsaari@garfield.fipnet.fi (Ville Saari) writes:
- >What is the right way for sub-process to exit and how can the main process
- >be absolutely sure the sub-process has exited?
-
- To exit, return from the function that CreateNewProc() called....
- I ObtainSharedSemaphore() on entry to the subprocess. And Release() it on
- exit.
- I attempt to ObtainSemaphore() on exit of the main process....
-
- There is, unfortunately, a hole between the ReleaseSemaphore() and the return
- from the entrypoint. Anyone know how to eliminate this (without a Forbid())?
- Also, be careful, there are race conditions on startup (if your main
- process attempts to leave before your startup process has ObtainShared()) --
- these are possible to fix pretty easily, though....
-
- Actually, the hole I'm talking about is even worse -- my ReleaseSemaphore()
- occurs in library code, not user-program code, so what -can- happen is
- that the main program attempts to exit, the library code gets an EXPUNGE, and
- the sub-process is left executing out of someone else's memory ;)
-
- I think the only way to eliminate this problem is to Forbid() -without-
- a matching Permit(), right before your ReleaseSemaphore() (of your
- subprocess).
- David C. Navas dnavas@oracle.com
- Working for, but not speaking on behalf of, Oracle Corp.
-