[asterisk-commits] kpfleming: trunk r44632 - in /trunk: ./ include/asterisk/linkedlists.h

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Oct 6 14:29:15 MST 2006


Author: kpfleming
Date: Fri Oct  6 16:29:14 2006
New Revision: 44632

URL: http://svn.digium.com/view/asterisk?rev=44632&view=rev
Log:
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)

........

Modified:
    trunk/   (props changed)
    trunk/include/asterisk/linkedlists.h

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/include/asterisk/linkedlists.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/linkedlists.h?rev=44632&r1=44631&r2=44632&view=diff
==============================================================================
--- trunk/include/asterisk/linkedlists.h (original)
+++ trunk/include/asterisk/linkedlists.h Fri Oct  6 16:29:14 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.



More information about the asterisk-commits mailing list