[connect.audit] Semaphores

haeb@ibmpcug.co.uk (Harry Broomhall) (11/25/89)

In article <1716@mathrt0.math.chalmers.se> d5adria@dtek.chalmers.se (Martin Adrian) writes:
> I can't get the function AddSemaphore to work.
> 
> My program looks like this:
> 
  (stuff deleted, but basicaly a simple call to AddSemaphore)
> 
> When i looked up the functions in programmers guide i found that AddSemaphore
> wants the Semaphorepointer in A1 and InitSemaphore in A0.
> (The lattice proto/exec.h was wrong about this)
> 
> Is this a known bug in Exec ?
> 
> Martin Adrian.

  yes - this is documented in the latest edition of RKM, and a work-around
is given:
  void  AddSemaphore(s)
  struct SignalSemaphore *s;
  {
     InitSemaphore(s);
     Forbid();
     Enqueue(&SysBase->SemaphoreList, s);
     Permit();
  }

   Note the use of the Forbid(), Permit() pair when playing with system
lists!

   On another note, Lattice C V5.02 has further faults in proto/exec.h
  The 'magic' numbers given for RemSemaphore and FindSemaphore are
wrong.  They imply that the semaphore is passed in A0, whem in fact it
is in A1.  Alter the numbers from 801 to 901 and all should work.

   Regards,
      Harry Broomhall.


-- 
Automatic Disclaimer:
The views expressed above are those of the author alone and may not
represent the views of the IBM PC User Group.