Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

Differences Between: [Versions 401 and 403]

(no description)

File Size: 76 lines (3 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

lock_utils:: (1 method):
  wait_for_lock_with_progress()


Class: lock_utils  - X-Ref

Lock utilities.

wait_for_lock_with_progress(lock_factory $lockfactory,string $resource,\core\progress\base $progress,int $timeout,string $message = '',int $progressupdatetime = 10,int $maxlifetime = DAYSECS,)   X-Ref
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.

param: lock_factory $lockfactory The factory to use to get the lock
param: string $resource The resource key we will try to get a lock on
param: base $progress The progress bar
param: int $timeout The maximum time in seconds to wait for a lock
param: string $message Optional message to display on the progress bar
param: int $progressupdatetime The number of seconds to wait for each lock attempt before updating the progress bar.
param: int $maxlifetime The maxlifetime to set on the lock, if supported.
return: lock|false A lock if successful, or false if the timeout expires.