AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Sintaxis WLanguage / Instrucciones estructuradas
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
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.
Ejemplo
// Using a Critical Section variable
Section is CriticalSection

// Use for a code block
//---------------------------
Use Section 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
USING CriticalSection("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

USING CriticalSection(t) IN
// Operations on the array by one only thread at a time
...
END
Sintaxis

Defining a critical section using a CriticalSection variable Ocultar los detalles

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 Ocultar los detalles

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 Ocultar los detalles

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" Ocultar los detalles

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>.
Versión mínima requerida
  • Versión 23
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 18/06/2025

Señalar un error o enviar una sugerencia | Ayuda local