NetBSD-Bugs archive

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

Re: lib/37654: libc's atexit_mutex should be fully recursive



The following reply was made to PR lib/37654; it has been noted by GNATS.

From: Andrew Doran <ad%netbsd.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: lib/37654: libc's atexit_mutex should be fully recursive
Date: Mon, 25 Feb 2008 13:30:13 +0000

 On Mon, Dec 31, 2007 at 09:20:00PM +0000, sverre%abbor.fesk.com@localhost 
wrote:
 
 >  /*
 > + * Initialize atexit_mutex with the PTHREAD_MUTEX_RECURSIVE attribute.
 > + * Note that __cxa_finalize may generate calls to __cxa_atexit.
 > + */
 > +static void
 > +atexit_mutex_init(void)
 > +{
 > +    mutexattr_t atexit_mutex_attr;
 > +    mutexattr_init(&atexit_mutex_attr);
 > +    mutexattr_settype(&atexit_mutex_attr, PTHREAD_MUTEX_RECURSIVE);
 > +    mutex_init(&atexit_mutex, &atexit_mutex_attr);
 > +    atexit_mutex_ready = 1;
 > +}
 > +
 > +/*
 
 In general the patch looks good, but this should be in a __libc_atexit_init()
 function called from src/lib/libc/misc/initfini.c. The call needs to go after
 __libc_thr_init(). In the atexit file it should be declared+defined like:
 
 void   __libc_atexit_init(void) __attribute__ ((visibility("hidden")));
 
 void
 __libc_atexit_init(void)
 {
        ...
 }
 
 Thanks,
 Andrew
 


Home | Main Index | Thread Index | Old Index