[Bug nptl/18435] pthread_once hangs when init routine throws an exception

msebor at redhat dot com sourceware-bugzilla@sourceware.org
Wed May 20 19:40:00 GMT 2015


https://sourceware.org/bugzilla/show_bug.cgi?id=18435

--- Comment #5 from Martin Sebor <msebor at redhat dot com> ---
A data point to add to comment #3: The comment above the pthread_once
declaration in sysdeps/nptl/pthread.h indicates that glibc anticipates that
programs might throw exceptions from the init routine.  The comment was added
when the __THROW decoration was removed from the function (in 2004). 
Unfortunately, no test case seems to have been added along with the change.

/* Guarantee that the initialization function INIT_ROUTINE will be called
   only once, even if pthread_once is executed several times with the
   same ONCE_CONTROL argument. ONCE_CONTROL must point to a static or
   extern variable initialized to PTHREAD_ONCE_INIT.

   The initialization functions might throw exception which is why
   this function is not marked with __THROW.  */
extern int pthread_once (pthread_once_t *__once_control,
                         void (*__init_routine) (void)) __nonnull ((1, 2));

-- 
You are receiving this mail because:
You are on the CC list for the bug.



More information about the Glibc-bugs mailing list