src/threadsafeclient.php
public function finish()
    {
        \Mutex::lock($this->mutex);
        if ($this->is_thread_running)
        {
            $this->queue_req(array('stop'));
            $this->join();
            $this->is_thread_running = false;
        }
        \Mutex::unlock($this->mutex);
   }
public function finish()
    {
        \Mutex::lock($this->mutex);
        if ($this->is_thread_running)
        {
            $this->queue_req(array('stop'));
            $this->join();
            $this->is_thread_running = false;
        }
        \Mutex::unlock($this->mutex);
   }
proceed.