//##ex mcpp:cppc -gs -o semaphore p:pLib/StartCode.o -pc semaphore.c p:pLib/StdIO.o -l pOSxA -l pOSStub -l pOS -l List

/*\
*** 29.01.1997, Michael Christoph, proDAD
*** Example:
\*/

#include <exec/types.h>
#include <exec/semaphores.h>
#include <clib/exec_protos.h>
#include <stdio.h>

#ifdef LATTICE
int CXBRK(void)  { return(0); }  /* Disable Lattice CTRL/C handling */
void chkabort(void) { return; }  /* really */
#endif

UBYTE *vers = "$VER: semaphore 1.0 (29.01.1997) (proDAD, Michael Christoph)";

struct SignalSemaphore LockSemaphore = {0};

VOID main(int argc,char *argv[])
{
    InitSemaphore(&LockSemaphore);
    ObtainSemaphore(&LockSemaphore);  /* Task now owns the semaphore. */

    /*  ...  */

    ReleaseSemaphore(&LockSemaphore); /* Task has released the semaphore. */
}
