LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Modified ThreadLocalVar example

I have modified the ThreadLocalVarexample which comes with CVI. I create 4
threads and each thread calls the same function. In this function I update a
numeric control. The numeric control is passed as a parameter to the thread
function. Thread function uses ThreadLocalVar to keep separate counters for
each of the 4 threads.

Now here is my problem. When I am just updating numeric controls with
SetCtrlVal function, if I hold left mouse key clicked on Title bar, the
threads keep running and see all 4 of my counters update.

Now instead of using Numeric control, I am adding new line to ListBox.
ListBox is passed as parameter to thread function and I use InserListItem to
add a new line. I keep count of how many lines are there in each list box b
y
using ThreadLocalVar. Now in this case, if I keep my left mouse clicked on
Title bar, my threads run but main apnel GUI does NOT get updated like in
case of Numeric controls above.

I made the app so that now I update both numeric and list box inside the
thread function. When holding the Title bar, numeric updates fine but
listbox doesn't.

So I would like to kow what is different between updating numeric control
and list box.



vishi
0 Kudos
Message 1 of 3
(2,956 Views)
Hello Vishi,
I modified the program as you described, and sent the control ID to the thread function. I did not have to hold left mouse key clicked on Title bar to see all the counters update. If you want, you could send your code through www.ni.com\ask so that I can take a look at it.

Mika Fukuchi
Application Engineer
National Instruments
0 Kudos
Message 2 of 3
(2,956 Views)
Mika,

It was the other way around. If I hold my left mouse key clicked on the
Title bar, the counter would update OK but if I use ListBox instead of
numeric counters, Listbox would not update. I will send the code, all I did
was add a ListBox to the example provided and inside thread function, update
both the numeric control and add new line to Listbox. If I don't keep left
mouse clicke dover title bar, both counter and listbox update ok. But if I
do hold the mouse key, only counter updates.

vishi

"mfukuchi" wrote in message
news:5065000000050000007ADA0000-1042324653000@exchange.ni.com...
> Hello Vishi,
> I modified the program as you described, and sent the control ID to
> the thread function. I did not have to hold left mouse key clicked o
n
> Title bar to see all the counters update. If you want, you could send
> your code through www.ni.com\ask so that I can take a look at it.
>
> Mika Fukuchi
> Application Engineer
> National Instruments
0 Kudos
Message 3 of 3
(2,956 Views)