public function run()
    {
        $quit = false;
        while (!$quit)
        {
            \Mutex::lock($this->thread_mutex);
            if (count($this->req_queue) == 0)
            {
                \Cond::wait($this->thread_cond, $this->thread_mutex);
                if (count($this->req_queue) == 0)
                {
                    \Mutex::unlock($this->thread_mutex);
                    continue;
                }
            }
            $reqs = array();
            while (count($this->req_queue) > 0 and count($reqs) < 10)
            {
                $m = $this->req_queue->shift();
                if ($m[0] == 'stop')
                {
                    $quit = true;
                    break;
                }
                $reqs[] = array($m[1], $m[2], $m[3], $m[4]);
            }
            \Mutex::unlock($this->thread_mutex);
            if (count($reqs) > 0)
                $this->pubbatch($reqs);
        }
    }
public function run()
    {
        $quit = false;
        while (!$quit)
        {
            \Mutex::lock($this->thread_mutex);
            if (count($this->req_queue) == 0)
            {
                \Cond::wait($this->thread_cond, $this->thread_mutex);
                if (count($this->req_queue) == 0)
                {
                    \Mutex::unlock($this->thread_mutex);
                    continue;
                }
            }
            $reqs = array();
            while (count($this->req_queue) > 0 and count($reqs) < 10)
            {
                $m = $this->req_queue->shift();
                if ($m[0] == 'stop')
                {
                    $quit = true;
                    break;
                }
                $reqs[] = array($m[1], $m[2], $m[3], $m[4]);
            }
            \Mutex::unlock($this->thread_mutex);
            if (count($reqs) > 0)
                $this->pubbatch($reqs);
        }
    }
public function run ( ) { $ quit = false ; while ( ! $ quit ) { \ Mutex :: lock ( $ this -> thread_mutex ) ; if ( count ( $ this -> req_queue ) == 0 ) { \ Cond :: wait ( $ this -> thread_cond , $ this -> thread_mutex ) ; if ( count ( $ this -> req_queue ) == 0 ) { \ Mutex :: unlock ( $ this -> thread_mutex ) ; continue ; } } $ reqs = array ( ) ; while ( count ( $ this -> req_queue ) > 0 and count ( $ reqs ) < 10 ) { $ m = $ this -> req_queue -> shift ( ) ; if ( $ m [ 0 ] == 'stop' ) { $ quit = true ; break ; } $ reqs [ ] = array ( $ m [ 1 ] , $ m [ 2 ] , $ m [ 3 ] , $ m [ 4 ] ) ; } \ Mutex :: unlock ( $ this -> thread_mutex ) ; if ( count ( $ reqs ) > 0 ) $ this -> pubbatch ( $ reqs ) ; } }
is provided in the request queue.
is provided in the request queue .