forked from VFPX/ParallelFox
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomplete_command.prg
More file actions
26 lines (21 loc) · 816 Bytes
/
Copy pathcomplete_command.prg
File metadata and controls
26 lines (21 loc) · 816 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
* Complete event returns thread ID of each worker
* This example uses one-line command rather than object for Complete handler
Set Path To "..;EXAMPLES" Additive
Local Parallel as Parallel
Parallel = NewObject("Parallel", "ParallelFox.vcx")
Clear
Wait "Starting workers..." Window Nowait
Parallel.StartWorkers(FullPath("complete_command.prg"))
* Use command rather than object as handler.
* IMPORTANT: Local variables are not in scope of command.
* When using command, parameters returned from worker are named tPar1, tPar2, etc.
Parallel.BindEvent("Complete", [? "Worker Thread ID:", tPar1])
Wait "Running code in parallel..." Window Nowait
Parallel.Call("GetThreadID", .t.)
Parallel.Wait()
Parallel.StopWorkers()
Wait clear
MessageBox("Code Complete.")
Procedure GetThreadID()
Return _VFP.ThreadID
EndProc