pthread_mutex_unlock(&( m ## _mutex)); \
} while(0)
+/* Add new global locks here please */
+# define UWRAP_LOCK_ALL \
+ UWRAP_LOCK(uwrap_id); \
+ UWRAP_LOCK(libc_symbol_binding); \
+
+# define UWRAP_UNLOCK_ALL \
+ UWRAP_UNLOCK(libc_symbol_binding); \
+ UWRAP_UNLOCK(uwrap_id)
+
#ifdef HAVE_CONSTRUCTOR_ATTRIBUTE
#define CONSTRUCTOR_ATTRIBUTE __attribute__ ((constructor))
#else
static void uwrap_thread_prepare(void)
{
- UWRAP_LOCK(uwrap_id);
- UWRAP_LOCK(libc_symbol_binding);
+ UWRAP_LOCK_ALL;
+
/*
* What happens if another atfork prepare functions calls a uwrap
* function? So disable it in case another atfork prepare function
{
uwrap.enabled = true;
- UWRAP_UNLOCK(libc_symbol_binding);
- UWRAP_UNLOCK(uwrap_id);
+ UWRAP_UNLOCK_ALL;
}
static void uwrap_thread_child(void)
{
struct uwrap_thread *u = uwrap.ids;
- UWRAP_LOCK(uwrap_id);
- UWRAP_LOCK(libc_symbol_binding);
+ UWRAP_LOCK_ALL;
while (u != NULL) {
UWRAP_DLIST_REMOVE(uwrap.ids, u);
dlclose(uwrap.libc.handle);
}
- UWRAP_UNLOCK(libc_symbol_binding);
- UWRAP_UNLOCK(uwrap_id);
+ UWRAP_UNLOCK_ALL;
}