Article View: comp.sys.amiga.tech
Article #2250Semaphores
From: d5adria Martin Adrian
Date: Mon, 20 Nov 1989 13:22
Date: Mon, 20 Nov 1989 13:22
40 lines
1580 bytes
1580 bytes
I can't get the function AddSemaphore to work.
My program looks like this:
main()
{
struct SignalSemaphore ss;
/* set name and pri */
AddSemaphore(&ss);
....
RemSemaphore(&ss);
}
The guru will show up every time with different nubers.
When i disassembled the exec function AddSemaphore it looked like this(Ks1.3):
AddSemaphore: JSR _LVOInitSemaphore(A6)
LEA SemaphoreList+LH_Head(A6),A0
BRA xxxx ;do Enqueue
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)
InitSemaphore also destroys A0,A1,D0,D1.
As far as i can see there is no way that this function can work.
BTW this macro works fine.
#define AddSemaphore(ss) InitSemaphore(ss),\
Enqueue(ExecBase->SemaphoreList,&(ss)->ss_Link)
^
the semaphore node
Is this a known bug in Exec ?
Martin Adrian.
Technical Details
Message-ID:
<1716@mathrt0.math.chalmers.se>Path:
arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!snorkelwacker!bloom-beacon!eru!luth!sunic!chalmers!mathrt0.math.chalmers.se!hacke1!d5adriaShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!snorkelwacker!bloom-beacon!eru!luth!sunic!chalmers!mathrt0.math.chalmers.se!hacke1!d5adria From: d5adria@dtek.chalmers.se. (Martin Adrian) Newsgroups: comp.sys.amiga.tech Subject: Semaphores Message-ID: <1716@mathrt0.math.chalmers.se> Date: 20 Nov 89 13:22:58 GMT Sender: news@mathrt0.math.chalmers.se Reply-To: d5adria@dtek.chalmers.se (Martin Adrian) Organization: Chalmers Univ. of Technology, Gothenburg, Sweden Lines: 40