/** * Acquires an exclusive lock on the specified DBObject. Once acquired, the lock is identified * by a unique "token" string. * @param string $sObjClass The class of the object for which to acquire the lock * @param integer $iObjKey The identifier of the object for which to acquire the lock * @return multitype:boolean iTopOwnershipLock Ambigous <boolean, string, DBObjectSet> */ public static function AcquireLock($sObjClass, $iObjKey) { $oMutex = new iTopMutex('lock_' . $sObjClass . '::' . $iObjKey); $oMutex->Lock(); $oOwnershipLock = new iTopOwnershipLock($sObjClass, $iObjKey); $token = $oOwnershipLock->Acquire(); $oMutex->Unlock(); return array('success' => $token !== false, 'token' => $token, 'lock' => $oOwnershipLock, 'acquired' => $oOwnershipLock->oToken->Get('acquired')); }