LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Thread freeze when trying to navigate in the menu

Solved!
Go to solution

I currently develop a monitoring software for an industrial machine.

 

On the main thread I process all the UI events, and in an AsyncTimer I do the data acquisition (via OPC). I protect my data structure using CmtNewLock, CmtGetLock, and CmtReleaseLock

The data acquired in the second thread are also used  in the main thread (graph, ...) When I access the data, I call CmtGetLock then do the processing and finish by calling CmtReleaseLock. It works well.

 

BUT when I navigate the menu bar,  the main thread freeze some times (or freeze after few seconds). It stopped on CmtGetLock and the UI doesn't response anymore (the menu tree is still deployed). The AsyncTimer continued and succeed to release and get the lock.

 

 Have you any idea about what can cause this bug ?

0 Kudos
Message 1 of 6
(4,012 Views)

I have also tried :

 

SetSystemAttribute (ATTR_ALLOW_UNSAFE_TIMER_EVENTS, 1);

 

but unfortunately it didn't change the result ...

0 Kudos
Message 2 of 6
(4,003 Views)
Here is an example of the problem.
Message Edité par Neb37 le 12-03-2008 07:12 AM
0 Kudos
Message 3 of 6
(3,994 Views)
Sorry for the file, it was not the good one.
0 Kudos
Message 4 of 6
(3,990 Views)
Solution
Accepted by topic author Neb37

Hi,

    i reproduce your problem on my PC /WinXP,CVI7.1.1, Pentium 4 2GHz/

    it`s seems to be a bug in CmtGetLog with "OPT_TL_PROCESS_EVENTS_WHILE_WAITING" and procesing menu.

    without this attribute, your test application works OK

      

    try replace in code: CmtNewLock("Catalog",0 /*OPT_TL_PROCESS_EVENTS_WHILE_WAITING*/,&lock_Catalog);

 

 

   

0 Kudos
Message 5 of 6
(3,962 Views)

Thanks,

 

It works fine. 

It works also fine (with OPT_TL_PROCESS_EVENTS_WHILE_WAITING) when there are no timer on panels but only timer in threads.

0 Kudos
Message 6 of 6
(3,957 Views)