Component Mutex

Table of Contents

Description

Occupies or vacates a critical section on the current site. Used to block an arbitrary operation (e.g. reading and modifying a site or global variable) from simultaneous execution in different script instances and associated harmful mutations. Can be used as an alternative to transactions.

The component suspends script execution until an initiative is issued confirming the capture of the named critical section.
The capture wait can be interrupted by a timeout and a capture failure occurs.

The critical section will be held until one of the following events:
a) execution of the section release in the same scenario by the same component with the "Release" action;
b) scheduled or unscheduled termination of the scenario handler;
c) expiration of the guaranteed release time specified in the component parameters.
d) reboot of the node or server executing the script.

The implementation of the component limits the application to a single site. The critical section is not bound to domains, specific servers, or scenarios. To enter such bindings, you should form a key using the name of the corresponding domain and/or server.

Table 1. System Characteristics

Index

147

Short title

mutex

Types of scenarios

All of them

Starter module

r_script_component_mutex

Mode

Asynchronous

Icon

147

Branching pattern

Branching, closing

Properties

Table 2. Properties
Specification Description

Title: The Key
Code: key
Visibility: no
Default: — 

Argument containing the name of the critical section.

Title: Action
Code: action
Visibility: no
Default: `Capture'

Select an action on the critical section.
Possible values:

  • Lock (lock, 1) - Wait for a turn and capture a critical section.

  • Release (unlock, 2) - Release the critical section.

Title: Transaction type
Code: mode
Visibility: yes
Default: write

Select the type of operation to be blocked.
Read operations may be mutually unblockable (e.g., find out the value of a global variable), but change operations (first taking the value of a global variable, then transforming and then saving the global variable) require full locking of the critical section.
Possible values:

  • read (read, 1) – Read operation. All read operations are accessed simultaneously until a write operation is queued up.

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

Used for gripping.

Title: Waiting time, ms
Code: timeoutMs
Visibility: yes
Default: 1000

An argument containing the timeout in milliseconds after which the capture wait should be terminated. Control is returned on the timeout branch.
Used for gripping`.

Title: Guaranteed release time, msec
Code: autoUnlockTimeoutMs
Visibility: yes
Default: 1000

Argument containing the lock hold time in milliseconds after which the critical section is guaranteed to be released without waiting for other events.
Used for gripping.

Title: Error to variable
Code: errorVar
Visibility: yes
Default: — 

Variable to save the error text in case the capture fails.

Title: Transition
Code: transfer
Visibility: no
Default: — 

The component to which control is passed on successful completion of the operation.

Title: Transition, Time
Code: transferTimeout
Visibility: no
Default: — 

The component to which control is passed after the operation result timeout expires.

Title: Transition, Error
Code: transferError
Visibility: no
Default: — 

The component to which control is passed if an error occurs.