TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Core\Locking\SemaphoreLockStrategy Class Reference
Inheritance diagram for TYPO3\CMS\Core\Locking\SemaphoreLockStrategy:
TYPO3\CMS\Core\Locking\LockingStrategyInterface

Public Member Functions

 __construct ($subject)
 
 __destruct ()
 
 release ()
 
 isAcquired ()
 
 acquire ($mode=self::LOCK_CAPABILITY_EXCLUSIVE)
 
 destroy ()
 

Static Public Member Functions

static getCapabilities ()
 
static getPriority ()
 

Public Attributes

const FILE_LOCK_FOLDER = 'typo3temp/locks/'
 
- Public Attributes inherited from TYPO3\CMS\Core\Locking\LockingStrategyInterface
const LOCK_CAPABILITY_EXCLUSIVE = 1
 
const LOCK_CAPABILITY_SHARED = 2
 
const LOCK_CAPABILITY_NOBLOCK = 4
 

Protected Attributes

 $id
 
 $resource
 
 $filePath = ''
 
 $isAcquired = false
 

Detailed Description

Semaphore locking

Definition at line 24 of file SemaphoreLockStrategy.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Locking\SemaphoreLockStrategy::__construct (   $subject)
Parameters
string$subjectID to identify this lock in the system
Exceptions
LockCreateException

Implements TYPO3\CMS\Core\Locking\LockingStrategyInterface.

Definition at line 52 of file SemaphoreLockStrategy.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\mkdir().

◆ __destruct()

TYPO3\CMS\Core\Locking\SemaphoreLockStrategy::__destruct ( )

Destructor

Definition at line 77 of file SemaphoreLockStrategy.php.

References TYPO3\CMS\Core\Locking\SemaphoreLockStrategy\release().

Member Function Documentation

◆ acquire()

TYPO3\CMS\Core\Locking\SemaphoreLockStrategy::acquire (   $mode = self::LOCK_CAPABILITY_EXCLUSIVE)

Try to acquire a lock

Parameters
int$modeLOCK_CAPABILITY_EXCLUSIVE
Returns
bool Returns TRUE if the lock was acquired successfully
Exceptions
LockAcquireExceptionif a semaphore could not be retrieved

Implements TYPO3\CMS\Core\Locking\LockingStrategyInterface.

Definition at line 129 of file SemaphoreLockStrategy.php.

References TYPO3\CMS\Core\Locking\SemaphoreLockStrategy\$isAcquired, and TYPO3\CMS\Core\Locking\SemaphoreLockStrategy\isAcquired().

◆ destroy()

TYPO3\CMS\Core\Locking\SemaphoreLockStrategy::destroy ( )

Destroys the resource associated with the lock

Returns
void

Implements TYPO3\CMS\Core\Locking\LockingStrategyInterface.

Definition at line 157 of file SemaphoreLockStrategy.php.

◆ getCapabilities()

static TYPO3\CMS\Core\Locking\SemaphoreLockStrategy::getCapabilities ( )
static
Returns
int LOCK_CAPABILITY_* elements combined with bit-wise OR

Implements TYPO3\CMS\Core\Locking\LockingStrategyInterface.

Definition at line 114 of file SemaphoreLockStrategy.php.

Referenced by TYPO3\CMS\Core\Tests\Unit\Locking\SemaphoreLockStrategyTest\setUp().

◆ getPriority()

static TYPO3\CMS\Core\Locking\SemaphoreLockStrategy::getPriority ( )
static
Returns
int Returns a priority for the method. 0 to 100, 100 is highest

Implements TYPO3\CMS\Core\Locking\LockingStrategyInterface.

Definition at line 147 of file SemaphoreLockStrategy.php.

◆ isAcquired()

TYPO3\CMS\Core\Locking\SemaphoreLockStrategy::isAcquired ( )

Get status of this lock

Returns
bool Returns TRUE if lock is acquired by this locker, FALSE otherwise

Implements TYPO3\CMS\Core\Locking\LockingStrategyInterface.

Definition at line 106 of file SemaphoreLockStrategy.php.

References TYPO3\CMS\Core\Locking\SemaphoreLockStrategy\$isAcquired.

Referenced by TYPO3\CMS\Core\Locking\SemaphoreLockStrategy\acquire(), and TYPO3\CMS\Core\Locking\SemaphoreLockStrategy\release().

◆ release()

TYPO3\CMS\Core\Locking\SemaphoreLockStrategy::release ( )

Release the lock

Returns
bool Returns TRUE on success or FALSE on failure

Implements TYPO3\CMS\Core\Locking\LockingStrategyInterface.

Definition at line 92 of file SemaphoreLockStrategy.php.

References TYPO3\CMS\Core\Locking\SemaphoreLockStrategy\isAcquired().

Referenced by TYPO3\CMS\Core\Locking\SemaphoreLockStrategy\__destruct().

Member Data Documentation

◆ $filePath

TYPO3\CMS\Core\Locking\SemaphoreLockStrategy::$filePath = ''
protected

Definition at line 41 of file SemaphoreLockStrategy.php.

◆ $id

TYPO3\CMS\Core\Locking\SemaphoreLockStrategy::$id
protected

Definition at line 31 of file SemaphoreLockStrategy.php.

◆ $isAcquired

TYPO3\CMS\Core\Locking\SemaphoreLockStrategy::$isAcquired = false
protected

◆ $resource

TYPO3\CMS\Core\Locking\SemaphoreLockStrategy::$resource
protected

Definition at line 36 of file SemaphoreLockStrategy.php.

◆ FILE_LOCK_FOLDER

const TYPO3\CMS\Core\Locking\SemaphoreLockStrategy::FILE_LOCK_FOLDER = 'typo3temp/locks/'

Definition at line 26 of file SemaphoreLockStrategy.php.