- Declaration
- Properties specific to ParallelTask variables
- WLanguage functions that use variables of type ParallelTask
ParallelTask (Type of variable) In french: TâcheParallèle
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.
// 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)
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. | ptoFullCopyHFSQLContext | Triggers 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. | ptoLightCopyHFSQLContext | Triggers 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. | ptoMainThread | Runs 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 name | Type used | Effect |
---|
Canceled | Boolean | - True if the task is canceled,
- False otherwise.
This property is read-only. | Completed | Boolean | - True if the task is completed,
- False otherwise.
This property is read-only. | Identifier | Integer | Task identifier. This identifier can be used for debugging purpose for example. This property is read-only. | ReturnedValue | Value 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. | Status | Integer constant | Task 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 - Standard functions:
- Functions with prefix syntax:
This page is also available for…
|
|
|
|