|
@@ -20,9 +20,6 @@ abstract class CoPool
|
|
|
public function get($args)
|
|
|
{
|
|
|
if(!empty($this->mFreeClients)) {
|
|
|
-// $client = $this->mFreeClients[0];
|
|
|
-// unset($this->mFreeClients[0]);
|
|
|
-// $this->mFreeClients = array_values($this->mFreeClients);
|
|
|
$client = array_shift($this->mFreeClients);
|
|
|
}
|
|
|
elseif($this->mUsingCount < $this->mMaxClient) {
|
|
@@ -31,14 +28,11 @@ abstract class CoPool
|
|
|
else {
|
|
|
$this->mSuspendCIDS[] = Co::getCid();
|
|
|
Co::suspend();
|
|
|
-// $client = $this->mFreeClients[0];
|
|
|
-// unset($this->mFreeClients[0]);
|
|
|
-// $this->mFreeClients = array_values($this->mFreeClients);
|
|
|
$client = array_shift($this->mFreeClients);
|
|
|
}
|
|
|
$this->mUsingCount++;
|
|
|
|
|
|
- Log::record("redis get mUsingCount={$this->mUsingCount}",Log::DEBUG);
|
|
|
+// Log::record("redis get mUsingCount={$this->mUsingCount}",Log::DEBUG);
|
|
|
return $client;
|
|
|
}
|
|
|
|
|
@@ -50,9 +44,9 @@ abstract class CoPool
|
|
|
if($cid > 0) {
|
|
|
Co::resume($cid);
|
|
|
}
|
|
|
- $count = count($this->mFreeClients);
|
|
|
- $waitings = count($this->mSuspendCIDS);
|
|
|
- Log::record("redis resume cid={$cid} mUsingCount={$this->mUsingCount} frees={$count} waitings={$waitings}",Log::DEBUG);
|
|
|
+// $count = count($this->mFreeClients);
|
|
|
+// $waitings = count($this->mSuspendCIDS);
|
|
|
+// Log::record("redis resume cid={$cid} mUsingCount={$this->mUsingCount} frees={$count} waitings={$waitings}",Log::DEBUG);
|
|
|
}
|
|
|
|
|
|
private function getSuspend()
|
|
@@ -61,9 +55,6 @@ abstract class CoPool
|
|
|
return 0;
|
|
|
}
|
|
|
else {
|
|
|
-// $cid = $this->mSuspendCIDS[0];
|
|
|
-// unset($this->mSuspendCIDS[0]);
|
|
|
-// $this->mSuspendCIDS = array_values($this->mSuspendCIDS);
|
|
|
$cid = array_shift($this->mSuspendCIDS);
|
|
|
return $cid;
|
|
|
}
|