ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage syntax / Structured statements
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
The instruction USE ... IN instruction automatically performs initialization and termination operations on critical sections.
This statement makes it possible to "forget" these operations (mainly ending operations) and to make the code more readable for highlighting the block to which the functionality relates.
Note: If the USE ... IN INSTRUCTION instruction via a RETURN instruction, the section is automatically ended.
Example
// Utilisation d'une variable de type Section Critique
Section is CriticalSection

// Utilisation pour un bloc de code
//---------------------------
USING Section IN
	// code protégé par la section critique
	// un seul thread pourra exécuter ce code à un moment donné
END
// Utilisation d'une section critique nommée
USING CriticalSection("MaSection") IN
	// Deux threads ne pourront pas exécuter ce code en même temps
	...
END
// Section critique sur une variable
t is array <critical section> of int

USING CriticalSection(t) IN
	// Manipulations sur le tableau par un seul thread en même temps
	...
END
Syntax

Defining a critical section using a CriticalSection variable Hide the details

USING <Critical Section> IN

    ...
END
<USING IN>:
Marks the beginning of the statement block.
<Critical Section>: CriticalSection variable
Name of the CriticalSection variable used to identify the critical section.

Defining a global section Hide the details

USING CriticalSection() IN
    ...
END
<USING IN>:
Marks the beginning of the statement block.
<CriticalSection>:
Enables the critical section. For more details, see CriticalSection.

Defining a named critical section Hide the details

USING CriticalSection(<Section name>) IN

    ...
END
<USING IN>:
Marks the beginning of the statement block.
<CriticalSection>:
Enables the critical section. For more details, see CriticalSection.
<Section name>: Character string
Identifies the critical section. This parameter is used to identify the protected code sections.

Defining a critical section on a variable with the extension attribute "Critical section" Hide the details

USING CriticalSection(<Variable>) IN

    ...
END
<USING IN>:
Marks the beginning of the statement block.
<CriticalSection>:
Enables the critical section. For more details, see CriticalSection.
<Variable>: Any type
Name of WLanguage variable that must be protected in a critical section. This variable must be defined with the extension attribute <critical section>.
Minimum version required
  • Version 23
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 06/18/2025

Send a report | Local help