/** * Set field value of an array in global storage * * @param string $name * @param string $field * @param mixed $value * @return mixed */ function &gs_array_set_field($name, $field, $value) { static $instance = null; if ($instance === null) { $instance =& GlobalStorage::instance(); } // if return $instance->arraySetField($name, $field, $value); }
$this->tstored = $thread->getStorageId(); /* @NOTE doesnt matter what reference to the stackable is passed to the thread */ } } } public function getStorageId() { return $this->stored; } public function getThreadStorageId() { return $this->tstored; } } /* this object we will pass everywhere we can */ $storage = new GlobalStorage(); /* this might be an SQLWorker, or just general purpose executor */ $worker = new GlobalWorker($storage); $worker->start(); /* in the real world where you're executing the storage: */ /* $worker->stack($storage); */ /* while(!$storage->isReady()) */ /* $storage->wait(); */ /* random array of work to populate some storage from the worker */ $work = array(); while (++$o < 20) { /* items stacked could be using resources available in worker */ $work[] = new MyWork($storage); } foreach ($work as $w) { $worker->stack($w);
public function testIncludeTwice() { GlobalStorage::includeOnce(dirname(__FILE__) . '/testInclude.php'); return $this->assertFalse(GlobalStorage::includeOnce(dirname(__FILE__) . '/testInclude.php'), 'The file should not have been included the second time'); }
/** * Sets the profiler * * @param Profiler $profiler */ public static function setProfiler($profiler) { self::$profiler = $profiler; }