[vtkusers] Python Bindings & GIL (Blocking issues)

Christopher Denter dennda at the-space-station.com
Thu Jan 21 16:29:18 EST 2010


Yes.

I just tested it. In my case it is sufficient to sleep 0.001 seconds to keep the UI responsive. I got 433 callbacks, so it is 0.433 seconds slower. I got no problem trading that for a functioning progress bar.

On 21. Jan, 2010, at 10:10 PM, Lic. José M. Rodriguez Bacallao wrote:

> yes, I did the same with the callback to ProgressEvents. If U sleep
> the thread, the load of the dataset will be (number_of_callback_fired
> * time_thread_is_sleeping) slower, isn't it?
> 
> PS: sorry, I will press the <reply all> next time.
> 
> On 1/21/10, Christopher Denter <dennda at the-space-station.com> wrote:
>> Hello,
>> 
>> in my particular case I have been able to work around the problem to some
>> degree by using callbacks for ProgressEvents (I need those anyway for a
>> progress bar) and a bad hack.
>> The bad hack is now that each time the callback is called, I make the thread
>> sleep for 0.05 seconds so that the main thread has some time to catch up.
>> 
>> Of course this is not a proper solution but just a bad hack. It helps
>> animate a progress bar though.
>> 
>> Jose, please make sure to hit 'Reply All' to also send a mail to the VTK
>> mailing list.
>> 
>> HTH,
>> 	Christopher
>> 
>> On 21. Jan, 2010, at 4:11 PM, Lic. José M. Rodriguez Bacallao wrote:
>> 
>>> I have the same issue, with vtk and PyQt threads or python threads,
>>> any suggestions?
>>> 
>>> On 1/20/10, Christopher Denter <dennda at the-space-station.com> wrote:
>>>> Hello.
>>>> 
>>>> In my application I want to load a large dataset in a different thread to
>>>> keep the UI responsive. However, as soon as the VTK code is executed,
>>>> only
>>>> that one thread runs and my UI freezes for the duration of the loading
>>>> operation. Do the VTK bindings block the python interpreter?
>>>> VTK_NO_PYTHON_THREADS is disabled. I'm running Python 2.6.4 on OSX 10.6.
>>>> 
>>>> (To be precise, all the thread does currently - for testing reasons - is
>>>> create a vtkDICOMImageReader and read a dataset. If I replace all VTK
>>>> related stuff with a simple time.sleep(10), the UI remains responsive,
>>>> hence
>>>> my conclusion.)
>>>> 
>>>> Thanks,
>>>> 	Christopher
>>>> _______________________________________________
>>>> Powered by www.kitware.com
>>>> 
>>>> Visit other Kitware open-source projects at
>>>> http://www.kitware.com/opensource/opensource.html
>>>> 
>>>> Please keep messages on-topic and check the VTK FAQ at:
>>>> http://www.vtk.org/Wiki/VTK_FAQ
>>>> 
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>> 
>>> 
>>> 
>>> --
>>> Lic. José M. Rodriguez Bacallao
>>> Centro de Biofisica Medica
>>> -----------------------------------------------------------------
>>> Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo
>>> mismo.
>>> 
>>> Recuerda: El arca de Noe fue construida por aficionados, el titanic
>>> por profesionales
>>> -----------------------------------------------------------------
>> 
>> 
> 
> 
> -- 
> Lic. José M. Rodriguez Bacallao
> Centro de Biofisica Medica
> -----------------------------------------------------------------
> Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo.
> 
> Recuerda: El arca de Noe fue construida por aficionados, el titanic
> por profesionales
> -----------------------------------------------------------------




More information about the vtkusers mailing list