--- asterisk-1.4.0-beta2/include/asterisk/linkedlists.h Fri Aug 25 05:53:43 2006 +++ asterisk-1.4.0-beta2.new/include/asterisk/linkedlists.h Fri Sep 29 10:09:56 2006 @@ -145,12 +145,30 @@ This would define \c struct \c entry_list, intended to hold a list of type \c struct \c entry. */ +#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) #define AST_LIST_HEAD_STATIC(name, type) \ struct name { \ struct type *first; \ struct type *last; \ ast_mutex_t lock; \ +} name; \ +static void __attribute__ ((constructor)) init_##name(void) \ +{ \ + AST_LIST_HEAD_INIT(&name); \ +} \ +static void __attribute__ ((destructor)) fini_##name(void) \ +{ \ + AST_LIST_HEAD_DESTROY(&name); \ +} \ +struct __dummy_##name +#else +#define AST_LIST_HEAD_STATIC(name, type) \ +struct name { \ + struct type *first; \ + struct type *last; \ + ast_mutex_t lock; \ } name = AST_LIST_HEAD_INIT_VALUE +#endif /*! \brief Defines a structure to be used to hold a list of specified type, statically initialized.