Skip to Content
0
Former Member
Aug 06, 2015 at 10:40 PM

Multithreading Question

52 Views

Using Eric Aling's example http://eric.aling.tripod.com/PB/tips/pbtip25.htm for multi-threading, I can't seem to find a way to have a process running in the main application's thread NOT stop the multi-threaded processes.

For example, if I place a multi-line edit control on the main w_multithread window, after clicking the MultiThreaded command button, I am not able to enter any text in the mle until after both threads have finished. However, if I put in yields as follows in the nv_test nvo, then I can easily enter text into the mle while the 2 threads are doing their work:

time t1

t1 = now()

do while secondsafter(t1,now()) < 20

il_Count++

yield()

inv_arg.triggerevent('ue_thread')

yield()

loop

return 1

However, what I don't understand is if I put a new command button on the main w_multithread window that runs a loop for 20,000 iterations and sets the value of a static text control to the String of the count, then after clicking the MultiThreaded command button, this loop will stop the 2 threads from doing their work until this loop has finished. Why is that if this loop is in the main application thread and the other 2 threads are not?

Even if I open a new window to perform the counting in the main thread, it too will stop the other 2 threads.

Any help is appreciated.

Kind Regards,

Greg