[vtk-developers] Threading Timer Issue

Taru S twrkmail at gmail.com
Fri May 4 15:12:59 EDT 2012


Hi Jean,

Thank you for the Qt timer link.

I basically have a device thread that runs at a higher rate compared to the
main app thread.
In an event callback function of my device thread I try to set a flag
indicating whether the window should be repainted or not. My approach is
similar to the one suggested by David in
http://public.kitware.com/pipermail/vtkusers/2004-April/073618.html

But, this fails because at some point that device thread tries to fetch the
variable that is locked by the application thread. So far, I tried using
the timer event /observer approach for the interactor. Will try this with
the Qt timer instead.

Is there any other way to address this without resorting to the Qt timer ?

I may not be able to post the entire code at this point but would try to do
so soon.

Thanks,
Tanu



On Fri, May 4, 2012 at 2:08 PM, Jean-Christophe Fillion-Robin <
jchris.fillionr at kitware.com> wrote:

> Hi Taru,
>
> If possible, it would be helpful if you could share some code (gist or
> github?)
>
> For Qt timer based approach you could probably look at the following [1]
>
> Hth
> Jc
>
> [1]
> https://github.com/commontk/CTK/blob/master/Libs/Visualization/VTK/Widgets/ctkVTKAbstractView.cpp#L66
>
>
> On Fri, May 4, 2012 at 1:39 PM, Taru S <twrkmail at gmail.com> wrote:
>
>> Hello All,
>>
>> I have integrated an external device with VTK. When interacting using the
>> external device things work fine for a few seconds but the attempt to
>> re-render the GUI (qt based) window fail after a while.
>>
>> I am using a vtk timer based approach to re-render the window in the main
>> application thread and use Mutex locks to set and unset the variables in
>> the device and application threads.
>>
>> The issue seems to occur when the device thread attempts to read the
>> variable that is locked for update by the application thread. The prog
>> throws a Qt exception at this point.
>>
>> Could someone please help me with this issue and suggest a workaround. I
>> tried creating a Qt based timer as well but for some reason it is not
>> getting invoked.
>>
>> Your help will be greatly appreciated.
>>
>> Thanks,
>> Tanu
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtk-developers
>>
>>
>>
>
>
> --
> +1 919 869 8849
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20120504/fb3ec3be/attachment.html>


More information about the vtk-developers mailing list