<div dir="ltr">Hi David,<div><br></div><div>As far as I know, ComputeRange always cached the result one way or another. It used to be in a data member I believe now it is in the information object (which I dislike but for other reasons). Given that it is a relatively heavy-weight operation, caching makes sense IMHO.  The alternative would be to use a mutex but that would kill the performance of GetRange(), specially when used in parallel. We could add a thread-safe version that always computed the range and stored it in the argument but I wouldn't recommend that people use it...</div>

<div><br></div><div>Best,</div><div>-berk</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 27, 2014 at 5:11 PM, David Gobbi <span dir="ltr"><<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi All,<br>
<br>
I was looking at vtkDataArray's ComputeRange code, and saw these:<br>
<br>
void vtkDataArray::ComputeRange(double range[2], int comp)<br>
line 1102:  info->Set( PER_COMPONENT(), infoVec );<br>
line 1112:  infoVec->SetNumberOfInformationObjects( this->NumberOfComponents );<br>
line 1154:  info->Set( rkey, range, 2 );<br>
<br>
Now, I always understood that it was necessary to be careful with<br>
calling GetRange() as far as thread safety is concerned.  However,<br>
these info->Set... calls surprised me.  Their presence means that<br>
ComputeRange() is non-reentrant in a very bad way.<br>
<br>
Is there a reason why ComputeRange() has to modify the array's<br>
info object?<br>
<br>
  David<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
</blockquote></div><br></div>