Waiting for a capture can be timed out, causing the capture to fail.

b) scheduled or unscheduled termination of the script handler; +\ c) expiration of the guaranteed release time specified in the component parameters. +\ d) rebooting the node or server executing the script.

Mutex Component

:icons:font :hardbreaks: :imagesdir: ../../../assets/images :toc-title: Contents :toc:

Description

Occupies or frees a critical section on the current site. It is used to block an arbitrary operation (for example, reading and modifying a site or global variable) from simultaneous execution in different instances of scripts and associated harmful mutations. Can be used as an alternative to transactions.

The component pauses script execution until an initiative is issued confirming the capture of the named critical section. +\

The critical section will be held until one of the events:
a) releasing a section in the same scenario by the same component with the action “Release”; +\

The implementation of the component limits its use to a single site. The critical section is not tied to domains, specific servers and scripts. To introduce such bindings, a key should be generated using the name of the corresponding domain and/or server.

Table 1. System characteristics

Index

147

Short name

mutex

Script types

All

Start module

r_script_component_mutex

Mode

Asynchronous

Icon

147

Branching type

Branching, closing

Properties

Table 2. Properties
Specification Description

Name: Key

Code: key

Visibility condition: no

Default: — 

An argument containing the name of the critical section.

Name: Action

Code: action

Visibility condition: no Default: Capture

Selecting an action on the critical section.

Possible values:

  • Block (lock, 1) – Wait in line and capture the critical section.

  • Free (unlock, 2) – Free the critical section.

Name: Operation type Code: mode Visibility condition: yes

Default: write

Select the type of operation to be blocked.

Read operations may not be mutually blocked (for example, getting the value of a global variable), but modification operations (first taking the value of a global variable, then converting and then saving the global variable) require a complete lock on the critical section.

Possible values:

  • read (read, 1) – Read operation. All read operations receive simultaneous access until a write operation is queued.

  • write (write, 2) – Write operation. Any write operation receives an individual critical section lock for the script handler process.

Used for capturing.

Name: Waiting time, ms

Code: timeoutMs

Visibility condition: yes

Default: 1000

An argument containing a timeout in milliseconds after which the capture wait should be stopped. Control returns via the timeout branch. Used for capturing`.

Name: Guaranteed release time, ms

Code: autoUnlockTimeoutMs

Visibility condition: yes

Default: 1000

An argument containing the lock holding time in milliseconds, after which the critical section is guaranteed to be freed without waiting for other events.

Used for capturing.

Name: Error in variable

Code: errorVar

Visibility condition: yes

Default: — 

Variable to save error text if capture fails.

Name: Transition

Code: transfer

Visibility condition: no Default: — 

The component to which control is transferred upon successful completion of the operation.

Name: Transition, time

Code: transferTimeout

Visibility condition: no

Default: — 

The component to which control is transferred after the timeout for waiting for the result of the operation.

Name: Transition, error Code: transferError Visibility condition: no

Default: — 

Component to which control is transferred in case of an error.