PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Using critical sections
  • Various
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 end of critical section: the code will be run by another thread.
To mark the start of critical section, use CriticalSectionStart.
Versions 24 and later
WindowsLinux 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
WindowsLinux 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
WindowsLinux 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 19 and later
WEBDEV - Server codeLinux This function is now available for the WEBDEV sites in Linux.
Linux This function is now available for the WINDEV applications in Linux.
New in version 19
WEBDEV - Server codeLinux This function is now available for the WEBDEV sites in Linux.
Linux This function is now available for the WINDEV applications in Linux.
WEBDEV - Server codeLinux This function is now available for the WEBDEV sites in Linux.
Linux This function is now available for the WINDEV applications in Linux.
Example
Versions 21 and later
WindowsLinux
// 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
WindowsLinux
// 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)
WindowsLinux
// 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
WindowsLinux

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

TCriticalSectionStart(<Critical section>)
<Critical section>: CriticalSection variable
Name of the CriticalSection variable used to identify the critical section.
New in version 24
WindowsLinux

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

TCriticalSectionStart(<Critical section>)
<Critical section>: CriticalSection variable
Name of the CriticalSection variable used to identify the critical section.
WindowsLinux

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

TCriticalSectionStart(<Critical section>)
<Critical section>: CriticalSection variable
Name of the CriticalSection variable used to identify the critical section.
Versions 21 and later
WindowsLinux

Ending a critical section on a variable Hide the details

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

Ending a critical section on a variable Hide the details

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

Ending a critical section on a variable Hide the details

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

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

CriticalSectionEnd([<Section name>])
<Section name>: Optional character string (with quotes)
Identifies the critical section.
Remarks

Using critical sections

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

Various

  • For more details on critical sections, see Managing the critical sections.
  • If a thread is destroyed while it is found in a critical section, the critical section is automatically freed.
  • A single thread is allowed in all the sections with the same name.
  • If sections use a different name, a thread can run the code of one section while another thread runs the code of another section.
Component : wd240vm.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment