[vtk-developers] Patch to vtkWrapPython.c to make wrapped Python code GIL-friendly

Prabhu Ramachandran prabhu_r at users.sf.net
Mon Jun 20 23:36:34 EDT 2005


>>>>> "Charl" == Charl P Botha <cpbotha at gmail.com> writes:

    >> Sorry to be such a pain, but you asked for comments. :-)

    Charl> Damn me! ;) For communicating between threads, there are
    Charl> proven existing constructs, such as for example the
    Charl> thread-safe Queue in Python.  In wxWidgets, the standard
    Charl> and excepted pattern is to pass EVT_MESSAGEs from the
    Charl> worker thread to the UI thread.  IMHO, it's better to use
    Charl> these things for inter-thread communication, as they were
    Charl> designed from the get-go with this in mind and the VTK
    Charl> observers weren't.

Well, I admit that most GUI libraries I know of are a pain when it
comes to multi-threading.

    Charl> How many (STABLE!) multi-threaded C++ VTK applications
    Charl> communicate between threads with VTK observers?

:)

    Charl> I'm not convinced yet, and remain stubbornly with my idea
    Charl> of keeping observers and the vtk objects that they observe
    Charl> in the same thread.  If a user wants inter-thread
    Charl> communication, she should use the data-structures and
    Charl> mechanisms that were designed for this purpose.

I guess I am asking for too much then.  Ultimately, he who writes the
patch has the rights. ;-) If you think this is good enough and serves
the purpose (afterall you do maintain large Python + VTK + GUI apps
yourself), then *IMHO* go ahead but I request that you document it in
the README and mention all the caveats.  If not you will end up
answering questions about async errors and other threading related
issues for a long time. :) A simple example/test-case would also be
good.

cheers,
prabhu



More information about the vtk-developers mailing list