[asterisk-commits] qwell: branch qwell/compiler-flag-abi r247333 - /team/qwell/compiler-flag-abi...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Feb 17 15:05:05 CST 2010


Author: qwell
Date: Wed Feb 17 15:05:01 2010
New Revision: 247333

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=247333
Log:
Let things actually compile

Modified:
    team/qwell/compiler-flag-abi/include/asterisk/lock.h

Modified: team/qwell/compiler-flag-abi/include/asterisk/lock.h
URL: http://svnview.digium.com/svn/asterisk/team/qwell/compiler-flag-abi/include/asterisk/lock.h?view=diff&rev=247333&r1=247332&r2=247333
==============================================================================
--- team/qwell/compiler-flag-abi/include/asterisk/lock.h (original)
+++ team/qwell/compiler-flag-abi/include/asterisk/lock.h Wed Feb 17 15:05:01 2010
@@ -141,112 +141,6 @@
 #include <stdio.h>
 
 #define AST_MAX_REENTRANCY 10
-
-static pthread_mutex_t empty_mutex;
-
-enum ast_lock_type {
-	AST_MUTEX,
-	AST_RDLOCK,
-	AST_WRLOCK,
-};
-
-/*!
- * \brief Store lock info for the current thread
- *
- * This function gets called in ast_mutex_lock() and ast_mutex_trylock() so
- * that information about this lock can be stored in this thread's
- * lock info struct.  The lock is marked as pending as the thread is waiting
- * on the lock.  ast_mark_lock_acquired() will mark it as held by this thread.
- */
-#if !defined(LOW_MEMORY)
-void ast_store_lock_info(enum ast_lock_type type, const char *filename,
-	int line_num, const char *func, const char *lock_name, void *lock_addr);
-#else
-#define ast_store_lock_info(I,DONT,CARE,ABOUT,THE,PARAMETERS)
-#endif
-
-
-/*!
- * \brief Mark the last lock as acquired
- */
-#if !defined(LOW_MEMORY)
-void ast_mark_lock_acquired(void *lock_addr);
-#else
-#define ast_mark_lock_acquired(ignore)
-#endif
-
-/*!
- * \brief Mark the last lock as failed (trylock)
- */
-#if !defined(LOW_MEMORY)
-void ast_mark_lock_failed(void *lock_addr);
-#else
-#define ast_mark_lock_failed(ignore)
-#endif
-
-/*!
- * \brief remove lock info for the current thread
- *
- * this gets called by ast_mutex_unlock so that information on the lock can
- * be removed from the current thread's lock info struct.
- */
-#if !defined(LOW_MEMORY)
-void ast_remove_lock_info(void *lock_addr);
-#else
-#define ast_remove_lock_info(ignore)
-#endif
-
-/*!
- * \brief retrieve lock info for the specified mutex
- *
- * this gets called during deadlock avoidance, so that the information may
- * be preserved as to what location originally acquired the lock.
- */
-#if !defined(LOW_MEMORY)
-int ast_find_lock_info(void *lock_addr, char *filename, size_t filename_size, int *lineno, char *func, size_t func_size, char *mutex_name, size_t mutex_name_size);
-#else
-#define ast_find_lock_info(a,b,c,d,e,f,g,h) -1
-#endif
-
-static void __attribute__((constructor)) init_empty_mutex(void)
-{
-	memset(&empty_mutex, 0, sizeof(empty_mutex));
-}
-
-static inline void ast_reentrancy_lock(ast_mutex_t *p_ast_mutex)
-{
-	pthread_mutex_lock(&p_ast_mutex->reentr_mutex);
-}
-
-static inline void ast_reentrancy_unlock(ast_mutex_t *p_ast_mutex)
-{
-	pthread_mutex_unlock(&p_ast_mutex->reentr_mutex);
-}
-
-static inline void ast_reentrancy_init(ast_mutex_t *p_ast_mutex)
-{
-	int i;
-	pthread_mutexattr_t reentr_attr;
-
-	for (i = 0; i < AST_MAX_REENTRANCY; i++) {
-		p_ast_mutex->file[i] = NULL;
-		p_ast_mutex->lineno[i] = 0;
-		p_ast_mutex->func[i] = NULL;
-		p_ast_mutex->thread[i] = 0;
-	}
-
-	p_ast_mutex->reentrancy = 0;
-
-	pthread_mutexattr_init(&reentr_attr);
-	pthread_mutexattr_settype(&reentr_attr, AST_MUTEX_KIND);
-	pthread_mutex_init(&p_ast_mutex->reentr_mutex, &reentr_attr);
-	pthread_mutexattr_destroy(&reentr_attr);
-}
-
-static inline void delete_reentrancy_cs(ast_mutex_t * p_ast_mutex)
-{
-	pthread_mutex_destroy(&p_ast_mutex->reentr_mutex);
-}
 
 /*!
  * \brief Unlock a lock briefly
@@ -283,6 +177,112 @@
 	pthread_t thread[AST_MAX_REENTRANCY];
 	pthread_mutex_t reentr_mutex;
 };
+
+static pthread_mutex_t empty_mutex;
+
+enum ast_lock_type {
+	AST_MUTEX,
+	AST_RDLOCK,
+	AST_WRLOCK,
+};
+
+/*!
+ * \brief Store lock info for the current thread
+ *
+ * This function gets called in ast_mutex_lock() and ast_mutex_trylock() so
+ * that information about this lock can be stored in this thread's
+ * lock info struct.  The lock is marked as pending as the thread is waiting
+ * on the lock.  ast_mark_lock_acquired() will mark it as held by this thread.
+ */
+#if !defined(LOW_MEMORY)
+void ast_store_lock_info(enum ast_lock_type type, const char *filename,
+	int line_num, const char *func, const char *lock_name, void *lock_addr);
+#else
+#define ast_store_lock_info(I,DONT,CARE,ABOUT,THE,PARAMETERS)
+#endif
+
+
+/*!
+ * \brief Mark the last lock as acquired
+ */
+#if !defined(LOW_MEMORY)
+void ast_mark_lock_acquired(void *lock_addr);
+#else
+#define ast_mark_lock_acquired(ignore)
+#endif
+
+/*!
+ * \brief Mark the last lock as failed (trylock)
+ */
+#if !defined(LOW_MEMORY)
+void ast_mark_lock_failed(void *lock_addr);
+#else
+#define ast_mark_lock_failed(ignore)
+#endif
+
+/*!
+ * \brief remove lock info for the current thread
+ *
+ * this gets called by ast_mutex_unlock so that information on the lock can
+ * be removed from the current thread's lock info struct.
+ */
+#if !defined(LOW_MEMORY)
+void ast_remove_lock_info(void *lock_addr);
+#else
+#define ast_remove_lock_info(ignore)
+#endif
+
+/*!
+ * \brief retrieve lock info for the specified mutex
+ *
+ * this gets called during deadlock avoidance, so that the information may
+ * be preserved as to what location originally acquired the lock.
+ */
+#if !defined(LOW_MEMORY)
+int ast_find_lock_info(void *lock_addr, char *filename, size_t filename_size, int *lineno, char *func, size_t func_size, char *mutex_name, size_t mutex_name_size);
+#else
+#define ast_find_lock_info(a,b,c,d,e,f,g,h) -1
+#endif
+
+static void __attribute__((constructor)) init_empty_mutex(void)
+{
+	memset(&empty_mutex, 0, sizeof(empty_mutex));
+}
+
+static inline void ast_reentrancy_lock(ast_mutex_t *p_ast_mutex)
+{
+	pthread_mutex_lock(&p_ast_mutex->reentr_mutex);
+}
+
+static inline void ast_reentrancy_unlock(ast_mutex_t *p_ast_mutex)
+{
+	pthread_mutex_unlock(&p_ast_mutex->reentr_mutex);
+}
+
+static inline void ast_reentrancy_init(ast_mutex_t *p_ast_mutex)
+{
+	int i;
+	pthread_mutexattr_t reentr_attr;
+
+	for (i = 0; i < AST_MAX_REENTRANCY; i++) {
+		p_ast_mutex->file[i] = NULL;
+		p_ast_mutex->lineno[i] = 0;
+		p_ast_mutex->func[i] = NULL;
+		p_ast_mutex->thread[i] = 0;
+	}
+
+	p_ast_mutex->reentrancy = 0;
+
+	pthread_mutexattr_init(&reentr_attr);
+	pthread_mutexattr_settype(&reentr_attr, AST_MUTEX_KIND);
+	pthread_mutex_init(&p_ast_mutex->reentr_mutex, &reentr_attr);
+	pthread_mutexattr_destroy(&reentr_attr);
+}
+
+static inline void delete_reentrancy_cs(ast_mutex_t * p_ast_mutex)
+{
+	pthread_mutex_destroy(&p_ast_mutex->reentr_mutex);
+}
 
 #else /* !DEBUG_THREADS */
 




More information about the asterisk-commits mailing list