ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing an application or website / Controls, windows and pages / Controls: Available types / Rich Text Area control
  • Example: Communication between 2 threads
ThreadSendSignal (Example)
Example: Communication between 2 threads
The following example is used communicate between two threads via ThreadWaitSignal and ThreadSendSignal.
// -- Project initialization code
GLOBAL
gnAction is int
 
// Runs the thread1
ThreadExecute("Thread1", threadNormal, ProcThread1)
 
// Runs the thread2
ThreadExecute("Thread2", threadNormal, ProcThread2)
 
// Waits for the end of Thread1 before continuing the program execution
ThreadWait("Thread1")
PROCEDURE ProcThread1()
bContinue is boolean = True
WHILE bContinue
ThreadWaitSignal()
SWITCH gnAction
CASE 1:
// <Process of action 1>
CASE 2:
// <Process of action 2>
OTHER CASE: bContinue = False
END
ThreadSendSignal("Thread2")
END
 
// End of Thread2
ThreadStop("Thread2")
PROCEDURE ProcThread2()
...
// <Code>
...
gnAction = 1
ThreadSendSignal("Thread1")
ThreadWaitSignal()
...
// <Code>
...
gnAction = 2
ThreadSendSignal("Thread1")
ThreadWaitSignal()
...
// <Code>
...
gnAction = 3
ThreadSendSignal("Thread1")
ThreadWaitSignal()
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help