12-03-2008 04:38 AM
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 ?
Solved! Go to Solution.
12-03-2008 04:59 AM
I have also tried :
SetSystemAttribute (ATTR_ALLOW_UNSAFE_TIMER_EVENTS, 1);
but unfortunately it didn't change the result ...
12-03-2008 07:07 AM - edited 12-03-2008 07:12 AM
12-03-2008 07:19 AM
12-04-2008 02:47 AM
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);
12-04-2008 04:32 AM
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.