示例#1
0
 /**
  * Constructor.
  * @param GPhpThreadCriticalSection|null $criticalSection Instance of the critical section that is going to be associated with the created thread. Variable with null value is also valid. REFERENCE type.
  * @param bool $allowThreadExitCodes Activates the support of thread exit codes. In that case the programmer needs to make sure that before the creation of a heavy thread there are no initialized objects whose destructors and particularly their multiple execution (in all the children and once in the parent) will affect the execution of the program in an undefined way.
  */
 public function __construct(&$criticalSection, $allowThreadExitCodes)
 {
     // {{{
     if (GPhpThread::$seed === 0) {
         self::$originPid = getmypid();
     }
     $this->uniqueId = GPhpThread::$seed++;
     $this->allowThreadExitCodes = $allowThreadExitCodes;
     $this->criticalSection =& $criticalSection;
     $this->parentPid = getmypid();
 }