This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

release

Release advisory lock on persistence service mutex

Syntax

TF = release(lk)

Description

TF = release(lk) releases an advisory lock on a persistence service mutex. If the lock expires before you release it, release returns a logical 0 (false). If this occurs, it may indicate potential data corruption.

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.lock('myDbLock','Connection','myRedisConnection')

Try to acquire advisory lock. If lock is unavailable, retry acquiring for 20 seconds.

acquire(lk, 20);

Release lock.

TF = release(lk)
TF =

  logical

   1

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 releasing the advisory lock was successful, and a logical 0 (false) otherwise.

Introduced in R2018b