[Insight-developers] LightObject race condition fix

Bill Lorensen bill.lorensen at gmail.com
Mon Aug 6 07:38:56 EDT 2007


Gaeten,

Which changes did we decide on? We should be very careful here. We don't
want any efficiency problems.

Bill

On 8/6/07, Gaëtan Lehmann <gaetan.lehmann at jouy.inra.fr> wrote:
>
>
> Le 12 juil. 07 à 00:31, Peter Cech a écrit :
>
> > On Wed, Jul 11, 2007 at 11:02:16 -0400, Karthik Krishnan wrote:
> >> On 7/11/07, Gaëtan Lehmann <gaetan.lehmann at jouy.inra.fr> wrote:
> >>>
> >>>
> >>> Le 11 juil. 07 à 15:33, Karthik Krishnan a écrit :
> >>>
> >>>> However I agree with Steve/Luis that access of the resource
> >>>> m_ReferenceCount be thread safe. One solution would be to use a
> >>>> scoped lock (unlocking is implemented in its destructor, so it
> >>>> automatically does that when it goes out of scope).
> >>>>
> >>>> The code would look like
> >>>>
> >>>> UnRegister()
> >>>> {
> >>>>   ScopedLock lock( m_ReferenceCountLock )
> >>>>   m_ReferenceCount--;
> >>>>   if ( m_ReferenceCount <= 0) { delete this;  }
> >>>> }
> >>>
> >>> Please correct if I'm wrong, but the mutex lock will be destroyed by
> >>> the delete call before the destruction of the ScopedLock object,
> >>
> >>
> >> You're right.. How silly of me :) I'd suggest leaving it as is..
> >
> > It's past midnight here, so I'll refrain from trying to post any
> > solutions, but there is something relevant here:
> >
> > http://softwarecommunity.intel.com/isn/Community/en-US/forums/
> > thread/30225804.aspx
> >
> > Enjoy!
> >
>
> Hi,
>
> I realize I haven't put the changes in the cvs repository.
> Can I do that ?
>
> Would be great also to explore Peter's link. It seem quite complex
> though, and I didn't get enough time yet to look at it carefully...
>
> Gaëtan
>
>
> --
> Gaëtan Lehmann
> Biologie du Développement et de la Reproduction
> INRA de Jouy-en-Josas (France)
> tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
> http://voxel.jouy.inra.fr
>
>
>
> _______________________________________________
> 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/20070806/0847ea35/attachment.htm


More information about the Insight-developers mailing list