ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

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
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 ParallelTask type is used to handle a task, which means a procedure run by a thread in the parallel programming.
Remark: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
Example
// Declares a variable to handle a parallel task
t is ParallelTask
// Builds a parallel task and triggers its execution on a procedure
t = ParallelTaskExecute(Proc, ("First parameter", 2))
// Builds a parallel task
t is ParallelTask(Proc, ("First parameter", 2))
// Triggers the execution of parallel task
ParallelTaskExecute(t)
// Describes a parallel task
d is Description of ParallelTask
d.Procedure = Proc
d.Parameter[1] = "First parameter"
d.Parameter[2] = 2
// Builds a parallel task and triggers its execution
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 run. This parameter can correspond to:
  • the name of the procedure to run.
  • the name of Procedure variable corresponding to the procedure to run.
<Parameters>: List of values enclosed in brackets and separated by commas
Parameters of procedure to run. This list of parameters has the following format:
(<Parameter 1>, ..., <Parameter N>)
where:
  • <Parameter 1>: First procedure parameter.
  • ...
  • <Parameter N>: Nth procedure parameter.
<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.
Caution: This constant cannot be used to run a parallel task in the main thread from 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 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.
Remarks

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.
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 constantTask status:
  • ptsCanceled: the parallel task is canceled (ParallelTaskCancel).
  • ptsCancellationRequested: a cancellation request was performed on the parallel task (ParallelTaskRequestCancellation).
  • ptsWaitingExecution: the parallel task is waiting to be run.
  • ptsWaitingPrevious: the parallel task waits for the execution of a previous parallel task.
  • ptsExecutionInProgress: the parallel task is currently run.
  • ptsNotScheduled: the parallel task is not scheduled.
  • ptsCompleted: the parallel task is ended.
This property is read-only.

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: 02/10/2023

Send a report | Local help