ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage syntax / Structured statements
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
The statement USING ... IN makes it possible to automatically perform initialization and ending 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.
Example
// Using a Critical Section variable
S is CriticalSection
 
// Use for a code block
//---------------------------
USING S IN
// code protected by the critical section
// only one thread will execute this code at a given moment
END
// Use of a named critical section
UTILISCriticalSection("MySection") IN
// Two threads will not be able to run this code at the same time
...
END
// Critical section on a variable
t is array <critical section> of int

UTILISCriticalSection(t) IN
// Operations on the array by one only thread at a time
...
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: 05/26/2022

Send a report | Local help