minor changes
This commit is contained in:
parent
ac2a584b8d
commit
17ab29ce00
|
@ -92,7 +92,7 @@ class Thread
|
|||
*/
|
||||
public function __construct( $runnable = null )
|
||||
{
|
||||
if(!Thread::isAvailable)throw new Exception("Threads not supported");
|
||||
if(!Thread::isAvailable() )throw new Exception("Threads not supported");
|
||||
if ( $runnable !== null ) {
|
||||
$this->setRunnable($runnable);
|
||||
}
|
||||
|
|
|
@ -70,22 +70,22 @@ class ThreadQueue {
|
|||
$this->cleanup();
|
||||
|
||||
if( (count($this->threads) < $this->queueSize) && count($this->jobs) ){
|
||||
$this->threads[] = $szal = new zsThread($this->callable);
|
||||
$this->threads[] = $szal = new Thread($this->callable);
|
||||
$szal->start( array_shift($this->jobs) );
|
||||
}
|
||||
|
||||
usleep(ThreadQueue::TICK_DELAY);
|
||||
return $this->size();
|
||||
return $this->queueSize();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* returns queue size
|
||||
* returns queue size with waiting jobs
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
|
||||
public function size(){
|
||||
public function queueSize(){
|
||||
return count($this->jobs);
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ class ThreadQueue {
|
|||
* @return int number of removed jobs
|
||||
*/
|
||||
public function flush(){
|
||||
$size = $this->size();
|
||||
$size = $this->queueSize();
|
||||
$this->jobs = array();
|
||||
return $size;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue