ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / Process functions / Parallel tasks
  • Declaration
  • Properties specific to ParallelTask variables
  • WLanguage functions that use variables of type ParallelTask
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
The ParallelTask type is used to handle a task, which means a procedure run by a thread in the parallel programming.
Note: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
Example
// Déclare une variable pour manipuler une tâche parallèle
t is ParallelTask
// Construit une tâche parallèle et déclenche son exécution sur une procédure
t = ParallelTaskExecute(Proc, ("Premier paramètre", 2))
// Construit une tâche parallèle 
t is ParallelTask(Proc, ("Premier paramètre", 2))
// Déclenche l'exécution de la tâche parallèle
ParallelTaskExecute(t)
// Décrit une tâche parallèle
d is Description of ParallelTask
d.Procedure = Proc
d.Parameter[1] = "Premier paramètre"
d.Parameter[2] = 2
// Construit une tâche parallèle et déclenche son exécution
t is ParallelTask = ParallelTaskExecute(d)
Declaration

Declaring a parallel task that is not described Hide the details

MyVariable is ParallelTask
In this case, the task is not described. The variable will have to be assigned with an existing task or with the result of one of the functions for running parallel tasks.

Describing a parallel task via the ParallelTask type Hide the details

MyVariable is ParallelTask(<Procedure> [, <Parameters> [, <Options>]])
<Procedure>: Character string or Procedure variable
Procedure to be executed. This parameter can correspond to:
  • the name of the procedure to be executed.
  • the name of the Procedure variable corresponding to the procedure to be executed.
<Parameters>: List of values enclosed in brackets, separated by commas
Parameters of the procedure to be executed. This list of parameters has the following format:
(<Parameter 1>, ..., <Parameter N>)
where:
  • <Parameter 1> is the first parameter of the procedure.
  • ...
  • <Parameter N> is the nth parameter of the procedure.
<Options>: Optional Integer constant
Options of task to run:
ptoDelayedCopyHFSQLContext
(Default value)
Triggers a light copy of HFSQL context during the first access to the HFSQL data.
ptoFullCopyHFSQLContextTriggers the immediate copy of the current HFSQL context.
Recommended, for example, if the parallel task must take into account the current positions in the files and queries of the context of the caller.
ptoLightCopyHFSQLContextTriggers the immediate copy of a part of the current HFSQL context.
Only the directories containing the data files in HFSQL Classic mode and/or the connections in HFSQL Client/Server mode are stored.
ptoMainThreadRuns the task in the main thread.
Warning: This constant cannot be used to execute a parallel task in the main thread from within the main thread.
In this case, the task is described and its description cannot be modified anymore.
The task is not automatically scheduled, therefore, a single declaration will not trigger the execution of the task. You must call one of the functions for running tasks in order to trigger the execution of the task.

Describing a parallel task via a Description of ParallelTask Hide the details

MyVariable is ParallelTask(<Description>)
<Description>: Description of ParallelTask variable
Name of the Description of ParallelTask variable describing the task.
In this case, the task is described and its description cannot be modified anymore.
The task is not automatically scheduled, therefore, a single declaration will not trigger the execution of the task. You must call one of the functions for running tasks in order to trigger the execution of the task.
Properties

Properties specific to ParallelTask variables

The following properties can be used to handle a parallel task:
Property nameType usedEffect
CanceledBoolean
  • True if the task is canceled,
  • False otherwise.
This property is read-only.
CompletedBoolean
  • True if the task is completed,
  • False otherwise.
This property is read-only.
New in version 2025
Extra
VariantAllows you to store advanced information without affecting the execution of the application. You can store values of any type (array, etc.). It is also possible to add members to the Extra property.
Example:
MyVariable.Extra.Info1 = Value
MyVariable.Extra[Info2] = Value2
MyVariable.Extra.Date = DateSys()
IdentifierIntegerTask identifier. This identifier can be used for debugging purpose for example.
This property is read-only.
ReturnedValueValue returned by the task. Caution:
  • If the task is still in progress, the ReturnedValue property waits for the end of the task
  • If the task is completed without fatal error, the property returns the return values of the procedure of the task.
This property is read-only.
StatusInteger constantStatus of the task:
  • tpeCancelled: parallel job is cancelled (function ParallelTaskCancel).
  • tpeRequestedCancellation: a cancellation request has been made on the parallel task (function ParallelTaskRequestCancellation)..
  • tpeWaitExecution the parallel task is waiting to be executed.
  • tpePreviousPreviousTask the parallel task waits for the execution of a previous parallel task.
  • tpeExecutionInProgress the parallel task is currently running.
  • tpeNotScheduled: parallel task is not scheduled.
  • tpeTerminated: parallel task completed.
This property is read-only.
Remarks

WLanguage functions that use variables of type ParallelTask

Minimum version required
  • Version 20
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/27/2025

Send a report | Local help