Port gtk-doc comments to their equivalent markdown syntax
[platform/upstream/gstreamer.git] / gst / gsttask.c
index d9e5697..d5ce87c 100644 (file)
@@ -22,6 +22,7 @@
 
 /**
  * SECTION:gsttask
+ * @title: GstTask
  * @short_description: Abstraction of GStreamer streaming threads.
  * @see_also: #GstElement, #GstPad
  *
@@ -111,6 +112,7 @@ struct _GstTaskPrivate
 };
 
 #ifdef _MSC_VER
+#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 
 struct _THREADNAME_INFO
@@ -133,7 +135,7 @@ SetThreadName (DWORD dwThreadID, LPCSTR szThreadName)
 
   __try {
     RaiseException (0x406D1388, 0, sizeof (info) / sizeof (DWORD),
-        (DWORD *) & info);
+        (const ULONG_PTR *) &info);
   }
   __except (EXCEPTION_CONTINUE_EXECUTION) {
   }
@@ -162,6 +164,8 @@ init_klass_pool (GstTaskClass * klass)
     gst_object_unref (klass->pool);
   }
   klass->pool = gst_task_pool_new ();
+  /* Classes are never destroyed so this ref will never be dropped */
+  GST_OBJECT_FLAG_SET (klass->pool, GST_OBJECT_FLAG_MAY_BE_LEAKED);
   gst_task_pool_prepare (klass->pool, NULL);
   g_mutex_unlock (&pool_lock);
 }
@@ -383,6 +387,9 @@ gst_task_cleanup_all (void)
   if ((klass = g_type_class_peek (GST_TYPE_TASK))) {
     init_klass_pool (klass);
   }
+
+  /* GstElement owns a GThreadPool */
+  _priv_gst_element_cleanup ();
 }
 
 /**
@@ -414,6 +421,8 @@ gst_task_new (GstTaskFunction func, gpointer user_data, GDestroyNotify notify)
 {
   GstTask *task;
 
+  g_return_val_if_fail (func != NULL, NULL);
+
   task = g_object_newv (GST_TYPE_TASK, 0, NULL);
   task->func = func;
   task->user_data = user_data;
@@ -440,6 +449,8 @@ gst_task_new (GstTaskFunction func, gpointer user_data, GDestroyNotify notify)
 void
 gst_task_set_lock (GstTask * task, GRecMutex * mutex)
 {
+  g_return_if_fail (GST_IS_TASK (task));
+
   GST_OBJECT_LOCK (task);
   if (G_UNLIKELY (task->running))
     goto is_running;
@@ -795,10 +806,10 @@ gst_task_join (GstTask * task)
   gpointer id;
   GstTaskPool *pool = NULL;
 
-  priv = task->priv;
-
   g_return_val_if_fail (GST_IS_TASK (task), FALSE);
 
+  priv = task->priv;
+
   tself = g_thread_self ();
 
   GST_DEBUG_OBJECT (task, "Joining task %p, thread %p", task, tself);