Skip to content

Commit

Permalink
Remove redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
zhgzhg authored Jan 2, 2025
1 parent 5fd3d19 commit 41b98f7
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions GPhpThread.php
Original file line number Diff line number Diff line change
Expand Up @@ -1314,14 +1314,14 @@ public function getUnrelResourceValueFast($name) { // {{{
*/
public function getResourceValue($name) { // {{{
if (!$this->doIOwnIt())
throw new \GPhpThreadException('[' . getmypid() . '][' . $this->uniqueId . '] Not owned critical section!');
throw new GPhpThreadException('[' . getmypid() . '][' . $this->uniqueId . '] Not owned critical section!');

if ($this->myPid == $this->creatorPid) { // local resource read request ; added to keep a consistency with getResourceValueFast
return $this->getResourceValueFast($name);
}

if (!$this->updateDataContainer(self::$READACT, $name, null))
throw new \GPhpThreadException('[' . getmypid() . '][' . $this->uniqueId . '] Error while retrieving the value!');
throw new GPhpThreadException('[' . getmypid() . '][' . $this->uniqueId . '] Error while retrieving the value!');

return $this->sharedData['rel'][$name];
} // }}}
Expand All @@ -1338,7 +1338,7 @@ public function getUnrelResourceValue($name) { // {{{
}

if (!$this->updateDataContainer(self::$UNRELREADACT, $name, null))
throw new \GPhpThreadException('[' . getmypid() . '][' . $this->uniqueId . '] Error while retrieving the value!');
throw new GPhpThreadException('[' . getmypid() . '][' . $this->uniqueId . '] Error while retrieving the value!');

return $this->sharedData['unrel'][$name];
} // }}}
Expand Down Expand Up @@ -1401,7 +1401,7 @@ public final function __toString() {
*/
public function import($value) {
if ($value instanceof self) {
throw new \GPhpThreadException("Not allowed cloning of GPhpThreadNotCloneableContainer!");
throw new GPhpThreadException("Not allowed cloning of GPhpThreadNotCloneableContainer!");
}
$this->variable = $value;
}
Expand Down Expand Up @@ -1543,12 +1543,12 @@ public final function __construct(&$criticalSectionObj, $lockMethod = 'lock', ar
$this->criticalSectionObj = &$criticalSectionObj;

if (!is_object($this->criticalSectionObj)) {
throw new \GPhpThreadException('Uninitialized critical section passed to GPhpThreadLockGuard!');
throw new GPhpThreadException('Uninitialized critical section passed to GPhpThreadLockGuard!');
}
if (empty($lockMethod) || empty($unlockMethod) ||
!method_exists($this->criticalSectionObj, $lockMethod) ||
!method_exists($this->criticalSectionObj, $unlockMethod)) {
throw new \GPhpThreadException('Not existing lock/unlock methods in &$criticalSectionObj!');
throw new GPhpThreadException('Not existing lock/unlock methods in &$criticalSectionObj!');
}

$this->unlockMethod = $unlockMethod;
Expand All @@ -1564,7 +1564,7 @@ public final function __construct(&$criticalSectionObj, $lockMethod = 'lock', ar
*/
public final function __destruct() {
if (!is_object($this->criticalSectionObj)) {
throw new \GPhpThreadException('Uninitialized &$criticalSectionObj attempted to be unlocked via GPhpThreadLockGuard!');
throw new GPhpThreadException('Uninitialized &$criticalSectionObj attempted to be unlocked via GPhpThreadLockGuard!');
}
if (!$this->unlockOnceProtector->export()) {
call_user_func_array(array($this->criticalSectionObj, $this->unlockMethod), $this->unlockMethodsParams);
Expand All @@ -1573,7 +1573,7 @@ public final function __destruct() {

/** @internal */
private function __clone() {
throw new \GPhpThreadException('Attempted to clone GPhpThreadLockGuard!');
throw new GPhpThreadException('Attempted to clone GPhpThreadLockGuard!');
}

/**
Expand Down Expand Up @@ -1759,7 +1759,7 @@ public static function isInGPhpThread(&$isInsideGPhpThread) { // {{{
return self::$seed !== 0 && self::$originPid !== 0 && self::$originPid !== getmypid();
}
if (!($isInsideGPhpThread instanceof \GPhpThreadNotCloneableContainer)) {
throw new \GPhpThreadException("Not supported parameter type - must be NULL or GPhpThreadNotCloneableContainer");
throw new GPhpThreadException("Not supported parameter type - must be NULL or GPhpThreadNotCloneableContainer");
}
$isInsideGPhpThread->import(false);
self::$originDynamicDataArr[((string)$isInsideGPhpThread)] = $isInsideGPhpThread;
Expand Down

0 comments on commit 41b98f7

Please sign in to comment.