[vtkusers] thread safety

Berk Geveci berk.geveci at kitware.com
Tue Sep 4 10:36:32 EDT 2012


Currently there are a lot of pitfalls in using VTK objects in a
multi-threaded application. I am working on addressing some of them and I
will also create a document describing what is and what is not possible.

What Gerald is describing should be possible. In fact, I have done it many
times in the past. I can't answer why the crash is happening without doing
some experimentation. Gerald: does the crash within a minimal code that
simply create vtkImageData in multiple threads? Or does it need the
full-blown filter to happen?

-berk

On Wed, Aug 29, 2012 at 12:14 PM, David E DeMarle
<dave.demarle at kitware.com>wrote:

> Unfortunately, VTK isn't thread safe, with the exception being
> operations (mostly limited to array access methods that are declared
> to be thread safe in doxygen) that take place in the Threaded* methods
> in subclasses of vtkThreadedImageAlgorithm.
>
> Berk is working on more wide scale thread/SMP parallel support, but
> that won't be in until after 6.0.
>
> If anyone on the list has had success in writing multithreaded VTK
> programs, I'ld like to see examples along with descriptions of what
> your approach was and what you had to mutex protect.
>
> David E DeMarle
> Kitware, Inc.
> R&D Engineer
> 21 Corporate Drive
> Clifton Park, NY 12065-8662
> Phone: 518-881-4909
>
>
> On Wed, Aug 29, 2012 at 2:47 AM, Lodron, Gerald
> <Gerald.Lodron at joanneum.at> wrote:
> > Hi
> >
> > I programmed an own vtk Filter which internally has multiple threads. In
> > each thread I create a vtkImageData object using
> >
> > vtkSmartPointer<vtkImageData>       oImage = vtkImageData::New();
> >
> > the problem is that sometimes the New() operator crashes, I debugged it
> the
> > the line 61 of vtkImageData.cxx:
> >
> > this->Information->Set(vtkDataObject::DATA_EXTENT(), this->Extent, 6);
> >
> > whereby the exact crash is in vtkInformationIntegerPointerKey.cxx on line
> > 58:
> >
> > if(this->RequiredLength >= 0 && length != this->RequiredLength)
> >
> > wherehy the “this” pointer is zero. I am not so deep familiar with that,
> any
> > suggestions?
> >
> > DI Gerald Lodron
> >
> > Machine Vision Applications
> >
> > DIGITAL - Institute for Information and Communication Technologies
> >
> > JOANNEUM RESEARCH Forschungsgesellschaft mbH
> > Steyrergasse 17, 8010 Graz, AUSTRIA
> >
> > phone:   +43-316-876-1751       personal fax: +43-316-876-91751
> > mobile:   +43-699-1876-1751      general fax: +43-316-876-1720
> > web: http://www.joanneum.at/digital
> > e-mail: gerald.lodron at joanneum.at
> >
> >
> >
> >
> > _______________________________________________
> > 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
> >
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120904/9df6b94d/attachment.htm>


More information about the vtkusers mailing list