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:07:00 -0500
User-agent: KMail/1.4.3

At one time I thought most things I would write would have self destructing 
and detached threads.  This didn't end up being the case, so I had somewhat 
ignored detached threads.  I simply assumed it would be safe to do a join and 
have it fail with an error on an already detached thread.  It would be a 
simple change to have it check detach state first.  But is 
pthread_attr_getdetachstate truelly common and portable or do we need to add 
another .m4 test for it?

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]