Main Content

own

Check ownership of advisory lock on a persistence service mutex object

Description

example

TF = own(lk) returns a logical 1 (true) if you own an advisory lock on the persistence service mutex, and returns a logical 0 (false) otherwise.

Examples

collapse all

First, create a persistence service controller object and use that object to start the persistence service.

ctrl = mps.cache.control('myRedisConnection','Redis','Port',4519);
start(ctrl)

Use the connection name to create a persistence service mutex.

lk = mps.sync.mutex('myDbLock','Connection','myRedisConnection')

Check if you own the advisory lock.

TF = own(lk)
TF =

  logical

   0

Input Arguments

collapse all

A persistence service specific mutex object. If you use Redis™ as your persistence provider, lk will be a mps.sync.TimedRedisMutex object. If you use a MATLAB® as your persistence provider, lk will be a mps.sync.TimedMATFileMutex object.

Output Arguments

collapse all

TF has a logical 1 (true) if you own the advisory lock on the persistence service mutex, and a logical 0 (false) otherwise.

Version History

Introduced in R2018b