/** * Waits until the item has been unlocked by another instance. * * This action is potentially dangerous since it may block user interface * until the lock has been released. * * @todo Should accept an optional argument to override the lock and return * false if the lock is not returned by x seconds. * * @access public * @return void */ public function waitLock() { $sem = new \Innomatic\Process\Semaphore('innoworkitem_' . $this->mItemType, $this->mItemId); $sem->waitGreen(); }
public function destroy() { $result = false; $sem = new \Innomatic\Process\Semaphore('cache', $this->mItemFile); $sem->waitGreen(); $sem->setRed(); if (strlen($this->mItemFile) and file_exists($this->mItemFile)) { $result = @unlink($this->mItemFile); } else { $this->mResult = CachedItem::ITEM_NOT_FOUND; } if ($result) { $result = $this->mrRootDb->execute('DELETE FROM cache_items WHERE application=' . $this->mrRootDb->formatText($this->mApplication) . ' AND itemid=' . $this->mrRootDb->formatText($this->mItemId)); } $sem->setGreen(); return $result; }
/** * Svuota il contenuto della clipboard. * @return bool * @access public */ public function erase() { $result = false; if ($this->IsValid()) { $sem = new \Innomatic\Process\Semaphore('clipboard', $this->fileName); $sem->waitGreen(); $sem->setRed(); $result = unlink($this->fileName); $sem->setGreen(); } else { $result = true; } return $result; }