AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Ayuda / Desarrollar una aplicación o un sitio web / Controles, ventanas y páginas / Controles: tipos disponibles / Control Área de texto enriquecido
  • 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()
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/05/2022

Señalar un error o enviar una sugerencia | Ayuda local