Php/docs/pht-queue.unlock
From Get docs
pht\Queue::unlock
(PECL pht >= 0.0.1)
pht\Queue::unlock — Releases the queue's mutex lock
Description
public pht\Queue::unlock ( ) : void
This method will release the mutex lock associated with the queue.
Parameters
This function has no parameters.
Return Values
No return value.
Examples
Example #1 Locking a queue's mutex lock
<?phpuse pht\{Thread, Queue};$thread = new Thread();$queue = new Queue();$thread->addFunctionTask(function ($queue) { $queue->lock(); $queue->push(1); $queue->unlock();}, $queue);$thread->start();// $queue is currently being used by multiple threads$queue->lock();$queue->push(1);$queue->unlock();$thread->join();// $queue is only being used in this thread now, so no need to lock itwhile ($queue->size()) { var_dump($queue->pop());}
The above example will output:
int(1) int(1)