Go to the documentation of this file.
88 $this->workers = $conf[
'workers'];
89 $this->maxqueue = $conf[
'maxqueue'];
90 $this->timeout = $conf[
'timeout'];
91 if ( isset( $conf[
'slots'] ) ) {
92 $this->slots = $conf[
'slots'];
100 $this->isMightWaitKey = !preg_match(
'/^nowait:/', $this->key );
117 $class = $conf[
'class'];
151 abstract public function release();
159 if ( $this->isMightWaitKey ) {
160 if ( self::$acquiredMightWaitKey ) {
170 'You may only aquire a single non-nowait lock.' );
172 } elseif ( $this->timeout !== 0 ) {
174 'Locks starting in nowait: must have 0 timeout.' );
208 return $type .
':' . ( hexdec( substr( sha1(
$key ), 0, 4 ) ) %
$slots );
static newFatal( $message,... $parameters)
Factory function for fatal errors.
onAcquire()
Update any lock tracking information when the lock is acquired.
A default PoolCounter, which provides no locking.
acquireForMe()
I want to do this task and I need to do it myself.
release()
I have successfully finished my task.
int $workers
Maximum number of workers working on tasks with the same key simultaneously.
onRelease()
Update any lock tracking information when the lock is released.
static bool $acquiredMightWaitKey
Whether this process holds a "might wait" lock key.
acquireForAnyone()
I want to do this task, but if anyone else does it instead, it's also fine for me.
When you have many workers (threads/servers) giving service, and a cached item expensive to produce e...
bool $isMightWaitKey
Whether the key is a "might wait" key.
int $maxqueue
If this number of workers are already working/waiting, fail instead of wait.
__construct( $conf, $type, $key)
string $key
All workers with the same key share the lock.
static newGood( $value=null)
Factory function for good results.
static factory( $type, $key)
Create a Pool counter.
int $slots
Maximum number of workers working on this task type, regardless of key.
$wgPoolCounterConf
Configuration for processing pool control, for use in high-traffic wikis.
float $timeout
Maximum time in seconds to wait for the lock.
hashKeyIntoSlots( $type, $key, $slots)
Given a key (any string) and the number of lots, returns a slot key (a prefix with a suffix integer f...
precheckAcquire()
Checks that the lock request is sane.