Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
core\lock\lock_utils Class Reference

Static Public Member Functions

static wait_for_lock_with_progress (lock_factory $lockfactory, string $resource, core\progress\base $progress, int $timeout, string $message='', int $progressupdatetime=10, int $maxlifetime=DAYSECS,)
 Start a progress bar and attempt to get a lock, updating the bar until a lock is achieved.
 

Member Function Documentation

◆ wait_for_lock_with_progress()

static core\lock\lock_utils::wait_for_lock_with_progress ( lock_factory $lockfactory,
string $resource,
core\progress\base $progress,
int $timeout,
string $message = '',
int $progressupdatetime = 10,
int $maxlifetime = DAYSECS )
static

Start a progress bar and attempt to get a lock, updating the bar until a lock is achieved.

This will make multiple attempts at getting the lock using a short timeout set by $progressupdatetime. After each failed attempt, it will update the progress bar and try again, until $timeout is reached.

Parameters
lock_factory$lockfactoryThe factory to use to get the lock
string$resourceThe resource key we will try to get a lock on
base$progressThe progress bar
int$timeoutThe maximum time in seconds to wait for a lock
string$messageOptional message to display on the progress bar
int$progressupdatetimeThe number of seconds to wait for each lock attempt before updating the progress bar.
int$maxlifetimeThe maxlifetime to set on the lock, if supported.
Return values
lock|falseA lock if successful, or false if the timeout expires.
Exceptions
coding_exception

The documentation for this class was generated from the following file: