Q: vtkMultiThreader. Threads. How to use? Example?

Lisa Sobierajski Avila lisa.avila at kitware.com
Fri Jul 2 13:45:56 EDT 1999


Hello Jim,

Yes, I agree that the use of pointers into storage within the class is not
good for multithreading. However, it is often good for speed. For example,
in an attempt to make a method thread-safe I removed this pointer to an
internal storage location and instead created the space to store the result
in and passed that into the call. Since this method was used quite
frequently throughout VTK, I quickly saw the results in the nightly
regression tests - many of the tests ran significantly slower, and the task
that I multithreaded ran slower on 4 processors than it had on one
previously! I am still in the process of trying to fix this since the
non-thread-safe part of this method was several calls deep and is not
easily exposed with a fast, safe alternate. 

Many methods (such as GetBounds() ) have two versions - one that is safe
and one that isn't. I have been attempting to document that in the
Description part of each method, and add safe alternatives where necessary,
but it is a long process and will probably not be close to complete until
VTK 3.0 (a couple of months from now).

Thanks for the feedback!

Lisa Avila
lisa.avila at kitware.com

At 02:50 PM 7/1/99 -0400, you wrote:
>
>
>Lisa,
>I haven't had a chance to get up to speed in the current vtk nightly
updates, so
>I am not posting this to the list directly. But in the last versions I was
>workng with (circa: Feb 99) The biggest nuisance was the static arrays
used to
>return "pointer to array" values for functions like vtkActor::GetBounds().
Even
>in a single threaded app if you simple keep the pointer the contents will
change
>with each subsequent GetBounds call to that module. This could lead to
some very
>curious variations in the array data when a function called does another
of the
>same array returning function after you have saved a pointer from he original
>call. IMHO, This type of storage "misuse" is the underlying cause of a
>significant number of "multi-thread" problems, and, when present, cannot be
>solved by mutex's or critical secions.
>
>Feel free to forward these comments to the list if you think it is
pertinent or
>useful to your users, and thanks for all the effort you folks at kitware are
>putting into this fine software.
>
>Thanks
>Jim Peterson
> 



-----------------------------------------------------------------------------
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