[Insight-developers] Re: LightObject race condition fix

Karthik Krishnan karthik.krishnan at kitware.com
Tue Aug 7 10:57:31 EDT 2007


On 8/7/07, kent williams <norman-k-williams at uiowa.edu> wrote:
>
> There's the real issue -- some effort goes into encouraging ITK code to
> never use a bare pointer.  Two threads can even share a reference to a
> smart
> pointer -- provided they use locks around code modifying the object
> pointed
> to.
>
> But raw pointers are pretty much a menace, and I've never been clear why
> some ITK code uses them as parameters...


For efficiency reasons, I suppose :

Imagine a Resample filter that needs to transform each pixel in an image
with an itk::Transform :

  TransformPoint(itk::Transform::Pointer t ) { // transform each pixel in
the image... }

Each function call would invoke the Register() which involves a mutex lock
and slow things down dramatically.. It might be justified to use them raw
pointers when you are dead sure that the object won't go away for the
lifetime of those calls, and just use :

  TransformPoint(itk::Transform * t );

-- 
Karthik Krishnan
R&D Engineer,
Kitware Inc.

On 8/7/07 5:28 AM, "Peter Cech" <pcech at vision.ee.ethz.ch> wrote:
> >
> > It is doable if you do not allow to obtain raw pointer to LightObject.
>
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.itk.org/mailman/private/insight-developers/attachments/20070807/714a9b6a/attachment.html


More information about the Insight-developers mailing list