Docs » Autodocs » exec.library » AddSemaphore
AddSemaphore -- initialize then add a signal semaphore to the system
AddSemaphore(signalSemaphore) A1 void AddSemaphore(struct SignalSemaphore *);
This function attaches a signal semaphore structure to the system's public signal semaphore list. The name and priority fields of the semaphore structure must be initialized prior to calling this function. If you do not want to let others rendezvous with this semaphore, use InitSemaphore() instead. If a semaphore has been added to the naming list, you must be careful to remove the semaphore from the list (via RemSemaphore) before deallocating its memory. Semaphores that are linked together in an allocation list (which ObtainSemaphoreList() would use) may not be added to the system naming list, because the facilities use the link field of the signal semaphore in incompatible ways
signalSemaphore -- an signal semaphore structure
Does not work in Exec <V36. Instead use this code: #include <exec/execbase.h> #include <exec/nodes.h> extern struct ExecBase *SysBase; ... void LocalAddSemaphore(s) struct SignalSemaphore *s; { s->ss_Link.ln_Type=NT_SIGNALSEM; InitSemaphore(s); Forbid(); Enqueue(&SysBase->SemaphoreList,s); Permit(); }
RemSemaphore(), FindSemaphore(), InitSemaphore()
|