Skip to content
Snippets Groups Projects
Commit eda94344 authored by Kevin P. Fleming's avatar Kevin P. Fleming
Browse files

Merged revisions 44631 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r44631 | kpfleming | 2006-10-06 16:28:03 -0500 (Fri, 06 Oct 2006) | 2 lines

ensure that mutex locks inside list heads are initialized properly on platforms that require constructor initialization (issue #8029, patch from timrobbins)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@44632 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent 62e6417b
No related branches found
No related tags found
No related merge requests found
......@@ -145,12 +145,30 @@ struct name { \
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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment