gstreamer_core/gst/gsttrace.h
branchRCL_3
changeset 29 567bb019e3e3
parent 0 0e761a78d257
child 30 7e817e7e631c
--- a/gstreamer_core/gst/gsttrace.h	Wed Mar 31 22:03:18 2010 +0300
+++ b/gstreamer_core/gst/gsttrace.h	Tue Aug 31 15:30:33 2010 +0300
@@ -92,8 +92,6 @@
 #endif
 
 
-
-
 GstTrace*	gst_trace_new			(gchar *filename, gint size);
 #ifdef __SYMBIAN32__
 IMPORT_C
@@ -132,6 +130,9 @@
  * Retrieve the remaining size in the @trace buffer.
  */
 #define 	gst_trace_get_remaining(trace) 	((trace)->bufsize - (trace)->bufoffset)
+#ifdef __SYMBIAN32__
+IMPORT_C
+#endif
 void 		gst_trace_set_default		(GstTrace *trace);
 #ifdef __SYMBIAN32__
 IMPORT_C
@@ -146,12 +147,14 @@
 
 
 void 		gst_trace_read_tsc		(gint64 *dst);
+
+
+extern GStaticMutex     _gst_trace_mutex;
 #ifdef __SYMBIAN32__
 IMPORT_C
 #endif
 
 
-
 gboolean		gst_alloc_trace_available	(void);
 #ifdef __SYMBIAN32__
 IMPORT_C
@@ -220,11 +223,15 @@
  */
 #define	gst_alloc_trace_new(trace, mem) 		\
 G_STMT_START {						\
-  if ((trace)->flags & GST_ALLOC_TRACE_LIVE) 		\
-    (trace)->live++;					\
-  if ((trace)->flags & GST_ALLOC_TRACE_MEM_LIVE) 	\
-    (trace)->mem_live = 				\
-      g_slist_prepend ((trace)->mem_live, mem);		\
+  if (G_UNLIKELY ((trace)->flags)) {                    \
+    g_static_mutex_lock (&_gst_trace_mutex);            \
+    if ((trace)->flags & GST_ALLOC_TRACE_LIVE) 		\
+      (trace)->live++;					\
+    if ((trace)->flags & GST_ALLOC_TRACE_MEM_LIVE) 	\
+      (trace)->mem_live = 				\
+        g_slist_prepend ((trace)->mem_live, mem);	\
+    g_static_mutex_unlock (&_gst_trace_mutex);          \
+  }                                                     \
 } G_STMT_END
 
 /**
@@ -236,11 +243,15 @@
  */
 #define	gst_alloc_trace_free(trace, mem) 		\
 G_STMT_START {						\
-  if ((trace)->flags & GST_ALLOC_TRACE_LIVE) 		\
-    (trace)->live--;					\
-  if ((trace)->flags & GST_ALLOC_TRACE_MEM_LIVE) 	\
-    (trace)->mem_live = 				\
-      g_slist_remove ((trace)->mem_live, mem); 		\
+  if (G_UNLIKELY ((trace)->flags)) {                    \
+    g_static_mutex_lock (&_gst_trace_mutex);            \
+    if ((trace)->flags & GST_ALLOC_TRACE_LIVE) 		\
+      (trace)->live--;					\
+    if ((trace)->flags & GST_ALLOC_TRACE_MEM_LIVE) 	\
+      (trace)->mem_live = 				\
+        g_slist_remove ((trace)->mem_live, mem); 	\
+    g_static_mutex_unlock (&_gst_trace_mutex);          \
+  }                                                     \
 } G_STMT_END
 
 #else