Closed determin1st closed 1 year ago
ooke, i think i found a solution to SyncSemaphore
with $initialval
greater than 1
, - have to wrap such a lock into object with another guard lock and shared memory which will keep lock counter.. so its solveable.
anyway, may hung as a feature request for getter methods
there is no method to check the state of the lock, either SyncMutex or SyncSemaphore - is it locked or not? no way to check, so the abstraction with SyncEvent is the simplest way to go, but semaphore allows multiple instances which makes checking unreliable
for example, set method
and clear method
will break when
lock is set but event is cleared, so the state is incorrect. couldn't it be simplified with get() method?
$n = $sem->get();# SyncSemaphore $x = $mutex->get();# SyncMutex