a1200   NEWS   APPS   DOCS   ABOUT
a1200
----
a1200
----
Autodocs
 Libraries:
 exec.library
  AVL_AddNode
  AVL_FindFirstNode
  AVL_FindLastNode
  AVL_FindNextNodeByAddress
  AVL_FindNextNodeByKey
  AVL_FindNode
  AVL_FindPrevNodeByAddress
  AVL_FindPrevNodeByKey
  AVL_RemNodeByAddress
  AVL_RemNodeByKey
  AbortIO
  AddDevice
  AddHead
  AddIntServer
  AddLibrary
  AddMemHandler
  AddMemList
  AddPort
  AddResource
  AddSemaphore
  AddTail
  AddTask
  Alert
  AllocAbs
  AllocEntry
  AllocMem
  AllocPooled
  AllocSignal
  AllocTrap
  AllocVec
  Allocate
  AttemptSemaphore
  AttemptSemaphoreShared
  AvailMem
  CacheClearE
  CacheClearU
  CacheControl
  CachePostDMA
  CachePreDMA
  Cause
  CheckIO
  CloseDevice
  CloseLibrary
  ColdReboot
  CopyMem
  CopyMemQuick
  CreateIORequest
  CreateMsgPort
  CreatePool
  Deallocate
  Debug
  DeleteIORequest
  DeleteMsgPort
  DeletePool
  Disable
  DoIO
  Enable
  Enqueue
  FindName
  FindPort
  FindResident
  FindSemaphore
  FindTask
  Forbid
  FreeEntry
  FreeMem
  FreePooled
  FreeSignal
  FreeTrap
  FreeVec
  GetCC
  GetMsg
  InitCode
  InitResident
  InitSemaphore
  InitStruct
  Insert
  MakeFunctions
  MakeLibrary
  ObtainQuickVector
  ObtainSemaphore
  ObtainSemaphoreList
  ObtainSemaphoreShared
  OldOpenLibrary
  OpenDevice
  OpenLibrary
  OpenResource
  Permit
  Procure
  PutMsg
  RawDoFmt
  ReleaseSemaphore
  ReleaseSemaphoreList
  RemDevice
  RemHead
  RemIntServer
  RemLibrary
  RemMemHandler
  RemPort
  RemResource
  RemSemaphore
  RemTail
  RemTask
  Remove
  ReplyMsg
  SendIO
  SetExcept
  SetFunction
  SetIntVector
  SetSR
  SetSignal
  SetTaskPri
  Signal
  StackSwap
  SumKickData
  SumLibrary
  SuperState
  Supervisor
  TypeOfMem
  UserState
  Vacate
  Wait
  WaitIO
  WaitPort
Include
GuruMeditation
Docs » Autodocs » exec.library » ObtainSemaphore

NAME

	ObtainSemaphore -- gain exclusive access to a semaphore

SYNOPSIS

	ObtainSemaphore(signalSemaphore)
A0
void ObtainSemaphore(struct SignalSemaphore *);

FUNCTION

	Signal semaphores are used to gain exclusive access to an object.
ObtainSemaphore is the call used to gain this access. If another
user currently has the semaphore locked the call will block until
the object is available.
If the current task already has locked the semaphore and attempts to
lock it again the call will still succeed. A "nesting count" is
incremented each time the current owning task of the semaphore calls
ObtainSemaphore(). This counter is decremented each time
ReleaseSemaphore() is called. When the counter returns to zero the
semaphore is actually released, and the next waiting task is called.
A queue of waiting tasks is maintained on the stacks of the waiting
tasks. Each will be called in turn as soon as the current task
releases the semaphore.
Signal Semaphores are different than Procure()/Vacate() semaphores.
The former requires less CPU time, especially if the semaphore is
not currently locked. They require very little set up and user
thought. The latter flavor of semaphore make no assumptions about
how they are used -- they are completely general. Unfortunately
they are not as efficient as signal semaphores, and require the
locker to have done some setup before doing the call.

INPUTS

       signalSemaphore -- an initialized signal semaphore structure

NOTES

	This function preserves all registers (see BUGS).

BUGS

	Until V37, this function could destroy A0.

SEE ALSO

ObtainSemaphoreShared(), InitSemaphore(), ReleaseSemaphore(), AttemptSemaphore(), ObtainSemaphoreList(), Procure(), Vacate()

Comments

Name:
E-mail: Use this if you want a message if you get a response, will not be shown.
Comment:
Select correct short for:

Razor 1911

ANA
RZR
FLT
DC

Comments:

$VER: d0.se 1.14 Copyright © 2011-2020 Tobias Geijersson support at d0 dot se