From 17ab29ce0095370ae4e6d7e41e4355863d4fd746 Mon Sep 17 00:00:00 2001 From: ZsBT Date: Fri, 10 Apr 2015 09:53:11 +0200 Subject: [PATCH] minor changes --- Thread.php | 2 +- ThreadQueue.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Thread.php b/Thread.php index 3e0b492..7606616 100644 --- a/Thread.php +++ b/Thread.php @@ -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); } diff --git a/ThreadQueue.php b/ThreadQueue.php index 648067c..8a41675 100644 --- a/ThreadQueue.php +++ b/ThreadQueue.php @@ -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; }