Q: vtkMultiThreader crash

Lisa Sobierajski Avila lisa.avila at kitware.com
Fri Jul 2 14:29:25 EDT 1999


Hi Audrius,

Spinning the interactor off as a separate thread seems quite dangerous to
me. In the other thread you would not be able to modify any of the data in
the pipeline (or the pipeline itself) without potential problems. It would
seem that it is better to set up as many interactors as you want and simply
initialize them (without doing a Start() method) then write your own single
event loop. This way you can interleave the tasks that you want to do
(other than interaction) without having to you multiple threads.

Lisa

At 07:07 AM 7/2/99 -0700, Audrius Stundzia wrote:
>Hi Lisa,
>
>Thanks for your detailed reply and suggestions.
>
>I'm back with more questions :-) after celebrating Canada Day up here.
>
>My problem is that at the end of a "typical" graphics pipeline that
>displays
>an isosurface, executing the interactor
>
>anInteractor->Initialize();
>anInteractor->Start();
>
>transfers controls to the event loop and I can't do anything else until
>I stop this loop. After looking at the vtkMultiThreader code and the 
>gradient example, I thought that the following code fragment would allow 
>me to spin off the interactor as a seperate thread:
>
>static VTK_THREAD_RETURN_TYPE StartInteractor( void *arg) // Single
>interactor thread
>{ 
>  vtkRenderWindowInteractor *interactor = (vtkRenderWindowInteractor *)arg;
>  
>  interactor->Initialize();
>  interactor->Start();
>  
>  return VTK_THREAD_RETURN_VALUE;
>
>}
>
>and at the end of the graphics pipeline: 
>
>   multiThreader->SetSingleMethod( StartInteractor
>                                 , (void *) anInteractor );
>                                 
>   multiThreader->SingleMethodExecute();    
>
>Everything compiles and links with no complaints, but when I execute the
>code I get the following error message: 
>
>fatal: relocation error: file ../libadvImage.so: symbol
>SetSingleMethod__16vtkMultiThreaderPFPv_vPv: referenced symbol not found 
>
>where .. reprensent a bunch of my subdirectories
>
>Any insight would be most appreciated.
>
>Best regards, 
>
>Audrius
>
>                         
>     
>
>
>
>
>On Thu, 01 Jul 1999 09:49:25 -0400, Lisa Sobierajski Avila wrote:
>
>> 
>> Hi Audrius,
>> 
>> You should not have a problem having several vtkRenderWindowInteractors
>in
>> the same thread - so you shouldn't need to worry about thread safeness
>for
>> that. As for your program going off and doing other stuff in another
>thread
>> it depends on what that other stuff is. I believe that on most platforms
>> you can't use OpenGL from more than one thread at a time (definitely not
>on
>> the same context). If you are not doing OpenGL and not working on the
>same
>> objects that the interactors are displaying (or the entire pipeline up to
>> that point) then everything is fine. If you are altering the pipelines or
>> any of the objects in the pipelines from the other thread, then it will
>be
>> difficult or maybe even impossible without adding mutex calls to the code
>> to guarantee that two threads don't collide.
>> 
>> Lisa
>> 
>> 
>> At 02:25 PM 6/30/99 -0700, Audrius Stundzia wrote:
>> >Hi Lisa,
>> >
>> >Thanks for your prompt reply. Much appreciated.
>> >I'll have a look at the examples.
>> >
>> >Basically, I want to spin off several vtkRenderWindowInteractor objects
>as
>> >seperate threads so that I can interact with the windows while my
>program
>> >goes off and does other stuff. Doable?
>> >
>> >Best regards, 
>> >
>> >Audrius
>> >
>> >On Wed, 30 Jun 1999 15:23:03 -0400, Lisa Sobierajski Avila wrote:
>> >
>> >> Hello Audrius,
>> >> 
>> >> Work is being done to make the graphics pipeline as thread safe as
>> >possible

>> >> - this work is still in progress. You still (and probably always will)
>> >have
>> >> to be fairly careful about which data access methods you use within
>> >> multi-threaded portions of vtk since we do not want to take the
>> >performance
>> >> hit of mutexing all data access.
>> >> 
>> >> A fairly simple example of how to use the vtkMultiThreader can be
>found
>> >in
>> >> vtkFiniteDifferenceGradientEstimator - the structured points data set
>is
>> >> divided among the available processors. The threader is also used in
>the
>> >> image filter superclass to thread the imaging pipeline, and in the ray
>> >> caster to thread the creation of ray casted images.
>> >> 
>> >> Lisa Avila
>> >> lisa.avila at kitware.com
>> >> 
>> >> 
>> >> 
>> >> At 07:04 AM 6/30/99 -0700, Audrius Stundzia wrote:
>> >> >Dear vtker's
>> >> >
>> >> >Looking at the vtk changes list, a great deal of work has recently
>gone
>> >> >into making the graphics pipeline multi-thead safe. Unfortunately, I
>> >> >haven't been able to find any examples of how to use threads in a 
>> >> >vtk context or how to use vtkMultiTreader. 
>> >> >
>> >> >As I'm on a Solaris, I'm using pthreads.
>> >> >
>> >> >Any help, especially example code, would be most appreciated.
>> >> >
>> >> >Regards,
>> >> >
>> >> >Audrius
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >_______________________________________________________
>> >> >Get your free, private email at http://mail.excite.com/
>> >> >
>> >> >
>> >>
>>
>>>--------------------------------------------------------------------------
>-
>> >--
>> >> >This is the private VTK discussion list.  Please keep messages
>on-topic.
>> >> >Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
>> >> >To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers"
>to
>> >> ><majordomo at gsao.med.ge.com>.  For help, send message body containing
>> >> >"info vtkusers" to the same address.     Live long and prosper.
>> >>
>>
>>>--------------------------------------------------------------------------
>-
>> >--
>> >> > 
>> >> 
>> >> 
>> >> 
>> >>
>>
>>---------------------------------------------------------------------------
>-
>> >-
>> >> This is the private VTK discussion list.  Please keep messages
>on-topic.
>> >> Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
>> >> To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
>> >> <majordomo at gsao.med.ge.com>.  For help, send message body containing
>> >> "info vtkusers" to the same address.     Live long and prosper.
>> >>
>>
>>---------------------------------------------------------------------------
>-
>> >-
>> >> 
>> >
>> >
>> >
>> >
>> >
>> >_______________________________________________________
>> >Get your free, private email at http://mail.excite.com/
>> 
>> > 
>> 
>> 
>> 
>>
>----------------------------------------------------------------------------
>-
>> This is the private VTK discussion list.  Please keep messages on-topic.
>> Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
>> To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
>> <majordomo at gsao.med.ge.com>.  For help, send message body containing

>> "info vtkusers" to the same address.     Live long and prosper.
>>
>----------------------------------------------------------------------------
>-
>> 
>
>
>
>
>
>_______________________________________________________
>Get your free, private email at http://mail.excite.com/
> 



-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------





More information about the vtkusers mailing list