/** * Check if process is locked by another user * * @param bool $needUnlock * @return bool|null */ public function isProcessLocked($needUnlock = true) { if (!$this->_streamHandler) { return null; } if ($this->_processLocked !== null) { return $this->_processLocked; } else { try { $this->_streamHandler->lock(LOCK_EX | LOCK_NB); if ($needUnlock) { $this->_streamHandler->unlock(); $this->_streamLocked = false; } else { $this->_streamLocked = true; } return false; } catch (FilesystemException $e) { return true; } } }