Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!bionet!agate!apple!oliveb!amiga!cbmvax!mks From: mks@cbmvax.UUCP (Michael Sinz - CATS) Newsgroups: comp.sys.amiga.tech Subject: Re: Parent/child processes Message-ID: <8084@cbmvax.UUCP> Date: 4 Oct 89 16:18:58 GMT References: <186@egrunix.UUCP> <8068@cbmvax.UUCP> <191@egrunix.UUCP> Reply-To: mks@cbmvax.UUCP (Michael Sinz - CATS) Organization: Commodore Technology, West Chester, PA Lines: 50 In article <191@egrunix.UUCP> cogswell@unix.secs.oakland.edu.UUCP (Dan Cogswell) writes: >In article <8068@cbmvax.UUCP> mks@cbmvax.UUCP (Michael Sinz - CATS) writes: >>Check the bindings and/or pragma for RemSemaphore as some error in older >>AutoDocs and AMIGA.LIB files had the parameter in the incorrect register. >>I should be in A1. >> > >I'm using Benchmark M2 and I gave Leon Frenkl a call down there and he says >his glue routines load into A1. Without a debugger, I have no good way of >checking if this is true, but I trust him. > >Here's an example that fails: > >MODULE Junk. > >FROM Semaphores IMPORT (etc...) > >VAR > mutex:SignalSemaphore; >BEGIN > InitSemaphore(mutex); > AddSemaphore(mutex); > > RemSemaphore(mutex); (* CRASH CITY!!! *) >END Junk. > >Am I doing something wrong?? > Unfortunately, the AddSemaphore() call is broken in the V33/V34 kickstart. (That is V1.2 and V1.3) The only real way to add a Semaphore to a public Semaphore list is to do it yourself with something like: InitSemaphore(mutex); Forbid(); Enqueue(&ExecBase->SemaphoreList,mutex); Permit(); Use those four lines insted of AddSemaphore()... Also, there is the problem of other tasks waiting for the Semaphore and you go and remove it... Just things you may need to watch out for. /----------------------------------------------------------------------\ | /// Michael Sinz -- CATS/Amiga Software Engineer | | /// PHONE 215-431-9422 UUCP ( uunet | rutgers ) !cbmvax!mks | | /// | |\\\/// When people are free to do as they please, | | \XX/ they usually imitate each other. | \----------------------------------------------------------------------/