PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
New WINDEV, WEBDEV, WINDEV Mobile 25 feature!
  • Declaration
  • Properties specific to the description of Thread variables
  • WLanguage functions that manage Thread variables
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
The Thread type allows you to define all the characteristics of a thread. The characteristics of this thread can be defined and modified using different WLanguage properties.
Remark: See Declaring a variable for more details on the declaration of this type of variable and the use of WLanguage properties.
Example
// Declare a variable to handle a thread
t is Thread
// Build a thread and trigger its execution on a procedure
t = ThreadExecute(Proc, ("First parameter", 2))
// Build a thread
t is Thread(Proc, ("First parameter", 2))
// Trigger the execution of the thread
ThreadExecute(t)
Declaration

Declaring a non-described thread Hide the details

MyVariable is Thread
In this case, the thread is not described. The variable will have to be assigned with an existing thread or with the result of one of the thread execution functions.

Describing a thread via the Thread type Hide the details

MyVariable is Thread (<Procedure> [, <Parameters> [, <Options>]])
<Procedure>: Character string or Procedure variable
Procedure to run. This parameter can correspond to:
  • the name of 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
Mode for starting the thread.
threadWaitForStartWaits for the actual start of the thread before continuing the execution.
threadGlobalContextForces the use of the global context of the project if the thread is run from a window. The thread will continue to run until the application is closed.
The window context is used by default, therefore the thread is stopped when closing the window.
Remark: If Thread is used in a global initialization code (project, class or set) or from any procedure or method called from a global initialization code, this constant has no effect.
threadNormalStarts the thread in normal mode. The HFSQL context is copied during the first use of a HFSQL feature.
threadFullCopyHFSQLContext
(Default value)
Triggers the immediate copy of current HFSQL context.
Recommended if the thread must take into account the current positions in the files and queries of caller context.
threadLightCopyHFSQLContextTriggers the immediate copy of part of 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.
In this case, the thread is described and its description can no longer be modified.
The thread is not executed automatically, so a declaration alone will not start the execution of the thread. You must call one of the thread execution functions to start the thread execution.
Remarks

Properties specific to the description of Thread variables

The following properties can be used to handle a Thread variable:
Property nameType usedEffect
StopRequestedBoolean
  • True if the thread was requested to stop,
  • False otherwise.
This property is available in read-only.
StatusInteger constantThread status:
  • threadStopRequested: Thread stop has been requested.
  • threadRunning: The thread is running.
  • threadNotExecuted: The thread has not been executed.
  • threadSuspended: The thread is suspended.
  • threadEnded: The thread exists but it has ended.
This property is available in read-only.
NameCharacter stringThread name.
This property is available in read-only.
PriorityInteger constantCurrent priority level of thread:
  • PriorityHigh: High priority
  • PriorityNormal: Standard priority
  • PriorityLow: Low priority

Remark: These properties can be handled by using one of the following syntaxes:
  • <Variable name>..<Property name>
  • <Variable name>.<Property name>

WLanguage functions that manage Thread variables

Versions 09 and later
ThreadExecute
New in version 09
ThreadExecute
ThreadExecute
Starts the execution of a secondary thread.
Versions 25 and later
ThreadRequestStop
New in version 25
ThreadRequestStop
ThreadRequestStop
Sends a stop request to a thread.
Versions 09 and later
ThreadSendSignal
New in version 09
ThreadSendSignal
ThreadSendSignal
The current thread sends an event to the specified thread in order to unlock it.
Versions 09 and later
ThreadWait
New in version 09
ThreadWait
ThreadWait
Waits for the end of execution of specified thread.
Minimum version required
  • Version 25
This page is also available for…
Comments
Click [Add] to post a comment