\dlpindex{mutual exclusion}
\dlpindex{accept statement}
Typically, a counter is used by only one process.
When an object is referred to by more than one process,
mutual exclusion between the evaluation of goals must be provided,
to guarantee that no two processes are simultaneously granted access to
a non-logical variable of that object.
The example of a semaphore, given below, also shows
the need of answer statements to postpone
the evaluation of a goal.
\Ex 6: semaphore
.ds sema.pl
The constructor for sema
causes the semaphore to loop over a conditional
that tests the value of the non-logical variable num.
When its value is zero only calls to will be answered
due to the answer statement , otherwise
both and may occur, since when num is not zero
the answer list is set to $(p,v)answer(p,v)p()v()p()