[aravis/aravis-0-2] fake_stream: avoid warnings on deprecated g_thread API.



commit a81002698dd5d09a2787630e291f440ac9c686a7
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Sun Apr 28 16:56:23 2013 +0200

    fake_stream: avoid warnings on deprecated g_thread API.

 src/arvfakegvcamera.c |   13 ++-----------
 src/arvfakestream.c   |    6 ++----
 src/arvmisc.h         |   10 ++++++++++
 3 files changed, 14 insertions(+), 15 deletions(-)
---
diff --git a/src/arvfakegvcamera.c b/src/arvfakegvcamera.c
index 1d01825..78cd0c6 100644
--- a/src/arvfakegvcamera.c
+++ b/src/arvfakegvcamera.c
@@ -296,14 +296,7 @@ arv_fake_gv_camera_new (const char *interface_name)
                goto INTERFACE_ERROR;
 
        gv_camera->cancel = FALSE;
-#if GLIB_CHECK_VERSION(2,32,0)
-       gv_camera->gvsp_thread = g_thread_new ("fake_gv_camera",
-                                              arv_fake_gv_camera_thread,
-                                              gv_camera);
-#else
-       gv_camera->gvsp_thread = g_thread_create (arv_fake_gv_camera_thread,
-                                                 gv_camera, TRUE, NULL);
-#endif
+       gv_camera->gvsp_thread = arv_g_thread_new ("fake_gv_camera", arv_fake_gv_camera_thread, gv_camera);
 
        return gv_camera;
 
@@ -472,9 +465,7 @@ main (int argc, char **argv)
        GOptionContext *context;
        GError *error = NULL;
 
-#if !GLIB_CHECK_VERSION(2,32,0)
-       g_thread_init (NULL);
-#endif
+       arv_g_thread_init (NULL);
        arv_g_type_init ();
 
        context = g_option_context_new (NULL);
diff --git a/src/arvfakestream.c b/src/arvfakestream.c
index 6328bd6..7c186b7 100644
--- a/src/arvfakestream.c
+++ b/src/arvfakestream.c
@@ -25,11 +25,10 @@
  * @short_description: Fake camera stream
  */
 
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
-
 #include <arvfakestream.h>
 #include <arvbuffer.h>
 #include <arvdebug.h>
+#include <arvmisc.h>
 
 static GObjectClass *parent_class = NULL;
 
@@ -134,8 +133,7 @@ arv_fake_stream_new (ArvFakeCamera *camera, ArvStreamCallback callback, void *us
 
        fake_stream->priv->camera = camera;
        fake_stream->priv->thread_data = thread_data;
-       fake_stream->priv->thread = g_thread_create (arv_fake_stream_thread,
-                                                    fake_stream->priv->thread_data, TRUE, NULL);
+       fake_stream->priv->thread = arv_g_thread_new ("fake_stream", arv_fake_stream_thread, 
fake_stream->priv->thread_data);
 
        return ARV_STREAM (fake_stream);
 }
diff --git a/src/arvmisc.h b/src/arvmisc.h
index 7d477e1..1c791af 100644
--- a/src/arvmisc.h
+++ b/src/arvmisc.h
@@ -81,13 +81,23 @@ ArvPixelFormat      arv_pixel_format_from_gst_caps          (const char *name, int bpp, 
int
 #endif
 
 #if GLIB_CHECK_VERSION(2,32,0)
+
 #define ARV_DEFINE_STATIC_MUTEX(mutex) static GMutex mutex
 #define arv_g_mutex_lock(mutex) g_mutex_lock(mutex)
 #define arv_g_mutex_unlock(mutex) g_mutex_unlock(mutex)
+
+#define arv_g_thread_init(vtable)
+#define arv_g_thread_new(name,func,data) g_thread_new(name,func,data)
+
 #else
+
 #define ARV_DEFINE_STATIC_MUTEX(mutex) static GStaticMutex mutex = G_STATIC_MUTEX_INIT
 #define arv_g_mutex_lock(mutex) g_static_mutex_lock(mutex)
 #define arv_g_mutex_unlock(mutex) g_static_mutex_unlock(mutex)
+
+#define arv_g_thread_init(vtable) g_thread_init(vtable)
+#define arv_g_thread_new(name,func,data) g_thread_create(func,data,TRUE,NULL)
+
 #endif
 
 G_END_DECLS


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]