‪TYPO3CMS  ‪main
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 ()
 
bool release ()
 
bool isAcquired ()
 
bool acquire ($mode=self::LOCK_CAPABILITY_EXCLUSIVE)
 
 destroy ()
 

Static Public Member Functions

static int getCapabilities ()
 
static int getPriority ()
 

Public Attributes

const FILE_LOCK_FOLDER = 'lock/'
 
const DEFAULT_PRIORITY = 25
 
- ‪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

int $id
 
resource SysvSemaphore null $resource
 
string $filePath = ''
 
bool $isAcquired = false
 

Detailed Description

Semaphore locking

Definition at line 27 of file SemaphoreLockStrategy.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Locking\SemaphoreLockStrategy::__construct (   $subject)

◆ __destruct()

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

Destructor

Definition at line 90 of file SemaphoreLockStrategy.php.

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

Member Function Documentation

◆ acquire()

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

Try to acquire a lock

Parameters
int$mode‪LOCK_CAPABILITY_EXCLUSIVE
Returns
‪bool Returns TRUE if the lock was acquired successfully
Exceptions
LockAcquireException‪if a semaphore could not be retrieved

Implements TYPO3\CMS\Core\Locking\LockingStrategyInterface.

Definition at line 142 of file SemaphoreLockStrategy.php.

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

◆ destroy()

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

Destroys the resource associated with the lock

Implements TYPO3\CMS\Core\Locking\LockingStrategyInterface.

Definition at line 170 of file SemaphoreLockStrategy.php.

◆ getCapabilities()

static int 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 127 of file SemaphoreLockStrategy.php.

References TYPO3\CMS\Core\Locking\LockingStrategyInterface\LOCK_CAPABILITY_EXCLUSIVE.

◆ getPriority()

static int TYPO3\CMS\Core\Locking\SemaphoreLockStrategy::getPriority ( )
static

◆ isAcquired()

bool 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 119 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()

bool 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 105 of file SemaphoreLockStrategy.php.

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

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

Member Data Documentation

◆ $filePath

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

Definition at line 44 of file SemaphoreLockStrategy.php.

◆ $id

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

Identifier used for this lock

Definition at line 36 of file SemaphoreLockStrategy.php.

◆ $isAcquired

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

◆ $resource

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

Semaphore Resource used for this lock

Definition at line 40 of file SemaphoreLockStrategy.php.

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

◆ DEFAULT_PRIORITY

◆ FILE_LOCK_FOLDER

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