bug-commoncpp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Thread bugs


From: David Sugar
Subject: Re: Thread bugs
Date: Thu, 9 Jan 2003 08:22:11 -0500
User-agent: KMail/1.4.3

I have looked at this more.  Using getdetachstate we can certainly determine 
if the thread was originally created "detached" with the fix for detach 
creation since it would be stored in the objects private attribute.  However, 
if a thread is arbitrarily detached then there is a race window between when 
that occurs and the priv->attr may be updated to reflect it.  I think we can 
assume most detached threads would likely be detached at creation and accept 
the current join attempt against the rare situation where a thread is later 
detached and then is attempted to be cancelled either without or before the 
priv->attr is modifed.

On Thursday 09 January 2003 06:55, Federico Montesino Pouzols wrote:
> Hi,...
>
> On Wed, Jan 08, 2003 at 08:53:01AM +0200, Ittay Freiman wrote:
> > 1. according to the documentation, one should do 'delete this' in
> > final(). however, in close() there is a check on 'priv' after calling
> > final(). when an application has many threads opening and closing, this
> > memory can already be allocated to some other object, thus this check
> > will (has for us) fail.
>
>       Um, that check is done in order to know if priv->_tid may be
> set to 0, however, priv->_tid is already set to 0 in terminate. Should
> not we remove the check and the priv->_tid = 0, or am I missing
> something?
>
> > 2. in terminate() a call to pthread_join() is made. according to the man
> > pages, this call is illegal for a detached thread. it does fail
> > sometimes for us.
>
>       Yes, pthread_join should only be called if it is not detached,
> which can be checked with pthread_attr_getdetachstate.
>
> > ittay
> > --
> > Ittay Freiman <address@hidden>
> > Qlusters Inc.
> >
> >
> >
> > _______________________________________________
> > Bug-commoncpp mailing list
> > address@hidden
> > http://mail.gnu.org/mailman/listinfo/bug-commoncpp
>
> _______________________________________________
> Bug-commoncpp mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/bug-commoncpp





reply via email to

[Prev in Thread] Current Thread [Next in Thread]