PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Using critical sections
  • Various
  • Equivalence
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Marks the start of a critical section: no other thread will be able to run the code as long as the current thread does not exit from the critical section.
To exit from the critical section, use CriticalSectionEnd.
Versions 24 and later
WindowsLinuxUniversal Windows 10 App When the calls to CriticalSectionStart and CriticalSectionEnd are in the same section of the code, it is recommended to use the type CriticalSection and the syntax USE ... IN.
Example:
// Using a Critical Section variable
S is CriticalSection

// Use for a code block
//---------------------------
UTILISSRIN
// code protected by the critical section
// only one thread will execute this code at a given moment
END
New in version 24
WindowsLinuxUniversal Windows 10 App When the calls to CriticalSectionStart and CriticalSectionEnd are in the same section of the code, it is recommended to use the type CriticalSection and the syntax USE ... IN.
Example:
// Using a Critical Section variable
S is CriticalSection

// Use for a code block
//---------------------------
UTILISSRIN
// code protected by the critical section
// only one thread will execute this code at a given moment
END
WindowsLinuxUniversal Windows 10 App When the calls to CriticalSectionStart and CriticalSectionEnd are in the same section of the code, it is recommended to use the type CriticalSection and the syntax USE ... IN.
Example:
// Using a Critical Section variable
S is CriticalSection

// Use for a code block
//---------------------------
UTILISSRIN
// code protected by the critical section
// only one thread will execute this code at a given moment
END
Versions 18 and later
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Universal Windows 10 App This function is now available in Windows Store apps mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Versions 19 and later
Linux This function is now available for the WEBDEV sites in Linux.
WINDEVLinux This function is now available for the WINDEV applications in Linux.
New in version 19
Linux This function is now available for the WEBDEV sites in Linux.
WINDEVLinux This function is now available for the WINDEV applications in Linux.
Linux This function is now available for the WEBDEV sites in Linux.
WINDEVLinux This function is now available for the WINDEV applications in Linux.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Example
Versions 21 and later
WindowsLinuxUniversal Windows 10 App
// Critical section on a variable
t is array <critical section> of int
CriticalSectionStart(t)
// Operations on the array by one only thread at a time
CriticalSectionEnd(t)
New in version 21
WindowsLinuxUniversal Windows 10 App
// Critical section on a variable
t is array <critical section> of int
CriticalSectionStart(t)
// Operations on the array by one only thread at a time
CriticalSectionEnd(t)
WindowsLinuxUniversal Windows 10 App
// Critical section on a variable
t is array <critical section> of int
CriticalSectionStart(t)
// Operations on the array by one only thread at a time
CriticalSectionEnd(t)
// Use of a named critical section
CriticalSectionStart("MySection")
// Two threads will not be able to run this code at the same time
...
CriticalSectionEnd("MySection")
Syntax
Versions 24 and later
WindowsLinuxUniversal Windows 10 App

Starting a critical section on a code section: using the CriticalSection type Hide the details

CriticalSectionStart(<Critical section>)
<Critical section>: CriticalSection variable
Name of the CriticalSection variable to identify the critical section.
New in version 24
WindowsLinuxUniversal Windows 10 App

Starting a critical section on a code section: using the CriticalSection type Hide the details

CriticalSectionStart(<Critical section>)
<Critical section>: CriticalSection variable
Name of the CriticalSection variable to identify the critical section.
WindowsLinuxUniversal Windows 10 App

Starting a critical section on a code section: using the CriticalSection type Hide the details

CriticalSectionStart(<Critical section>)
<Critical section>: CriticalSection variable
Name of the CriticalSection variable to identify the critical section.
Versions 21 and later
WindowsLinuxUniversal Windows 10 App

Starting a critical section on a variable Hide the details

CriticalSectionStart([<Variable name>])
<Variable name>: Any type
Name of WLanguage variable that must be protected in a critical section. This variable must be defined with the attribute <critical section>.
New in version 21
WindowsLinuxUniversal Windows 10 App

Starting a critical section on a variable Hide the details

CriticalSectionStart([<Variable name>])
<Variable name>: Any type
Name of WLanguage variable that must be protected in a critical section. This variable must be defined with the attribute <critical section>.
WindowsLinuxUniversal Windows 10 App

Starting a critical section on a variable Hide the details

CriticalSectionStart([<Variable name>])
<Variable name>: Any type
Name of WLanguage variable that must be protected in a critical section. This variable must be defined with the attribute <critical section>.

Starting a named critical section on a code section Hide the details

CriticalSectionStart([<Section name>])
<Section name>: Optional character string (with quotes)
Identifies the critical section. This parameter is used to identify the protected code sections.
If this parameter is not specified, an automatic critical section is implemented.
Note: the automatic critical section and the critical section corresponding to an empty string ("") are different.
Remarks

Using critical sections

To handle critical sections, the management mode of threads must be changed by ThreadMode (associated with the ThreadCriticalSection constant).

Various

Equivalence

SemaphoreStart("SemaphoreName")
is equivalent to:
CriticalSectionStart("MyCriticalSection")
Indeed, by default, SemaphoreStart creates a semaphore limited to a single thread.
Component : wd240vm.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment