Skip to Content
Mar 31, 2016 at 12:46 AM

PB & multithreading & loops = not responding


I am using PB12.5

I created a pbl that has a window and it creates 10 threads each of which connects to the database and starts a timer which sends a simple select to the database. It creates traffic over the network.

I can see the traffic when I go to resmon (windows resource monitor) and go to overview tab and click on PB125.exe

then go to the network tab and under TCP connections I right click on title and make sure I can see: send receive total

I will see each of the 10 threads and the traffic it is sending.

What doesn't work is when I have a long loop in the application. (click on LOOP button) Then the threads stop sending data.

On the Resource Monitor it will dwindle down to 0 traffic. Which means the threads are not running

When I put a yield in the loop it works but it is slow and it is multithreaded then I shouldn't have to do that.

Maybe I didn't set it up correctly - I attached the pbl.

I can send the pbl. i

Window creates NVO (main) which adds an array of 10 NVOs (TR) with transaction objects.

Each NVO (TR) creates a thread which sends out network traffic every N seconds.

In the Window there is a LOOP button and when that is click it just goes into a loop (doesn't do anything)

pbl 8 objects

muti: application object opens window

w_multi: window has open event which creates the NVO (main) and executes a function which adds 10 connections

n_trnvo_main: NVO main has one fx that creates 10 NVO transactions

n_trnvo NVO transactions connects to the database and creates a thread passing itself to the subthread

nv_shared: shared NVO creates a timer which call ue_wakeup every 5 secs
n_timer: calls ue_wakeup in nv_shared

nv_arg: executes SQL

n_tr: transaction object

ue_wakeup event executes subthread ue_wakeup event which executes the NVO transaction to send SQL

the code is here:

Click the ORANGE download button the other buttons are advertisements

I really appreciate any help. This has me stumped. TIA