[farsight2/master] Add mutex, context and loop

Olivier Crête olivier.crete at collabora.co.uk
Tue Dec 23 15:24:52 PST 2008


---
 fs-upnp-simple-igd-thread.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/fs-upnp-simple-igd-thread.c b/fs-upnp-simple-igd-thread.c
index 5e94874..4520f57 100644
--- a/fs-upnp-simple-igd-thread.c
+++ b/fs-upnp-simple-igd-thread.c
@@ -29,6 +29,7 @@ struct _FsUpnpSimpleIgdThreadPrivate
   GThread *thread;
   GMainLoop *loop;
   GMainContext *context;
+  GMutex *mutex;
 };
 
 
@@ -62,16 +63,27 @@ static void
 fs_upnp_simple_igd_thread_init (FsUpnpSimpleIgdThread *self)
 {
   self->priv = FS_UPNP_SIMPLE_IGD_THREAD_GET_PRIVATE (self);
+
+  self->priv->mutex = g_mutex_new ();
+  self->priv->context = g_main_context_new ();
 }
 
 static void
 fs_upnp_simple_igd_thread_finalize (GObject *object)
 {
-  //FsUpnpSimpleIgdThread *self = FS_UPNP_SIMPLE_IGD_THREAD_CAST (object);
+  FsUpnpSimpleIgdThread *self = FS_UPNP_SIMPLE_IGD_THREAD_CAST (object);
+
+  g_main_context_unref (self->priv->context);
+  g_mutex_free (self->priv->mutex);
+
+  G_OBJECT_CLASS (fs_upnp_simple_igd_thread_parent_class)->finalize (object);
 }
 
 static void
 fs_upnp_simple_igd_thread_constructed (GObject *object)
 {
   //FsUpnpSimpleIgdThread *self = FS_UPNP_SIMPLE_IGD_THREAD_CAST (object);
+
+  if (G_OBJECT_CLASS (fs_upnp_simple_igd_thread_parent_class)->constructed)
+    G_OBJECT_CLASS (fs_upnp_simple_igd_thread_parent_class)->constructed (object);
 }
-- 
1.5.6.5




More information about the farsight-commits mailing list