[farsight2/master] Remove threading stuff for now
Olivier Crête
olivier.crete at collabora.co.uk
Tue Dec 23 15:24:32 PST 2008
---
fs-upnp-simple-igd.c | 92 --------------------------------------------------
fs-upnp-simple-igd.h | 3 --
2 files changed, 0 insertions(+), 95 deletions(-)
diff --git a/fs-upnp-simple-igd.c b/fs-upnp-simple-igd.c
index 964aa05..f6d0292 100644
--- a/fs-upnp-simple-igd.c
+++ b/fs-upnp-simple-igd.c
@@ -28,11 +28,8 @@
struct _FsUpnpSimpleIgdPrivate
{
- GMainLoop *loop;
GMainContext *main_context;
- /* These are to be used only for the main thread */
-
GUPnPContext *gupnp_context;
GUPnPControlPoint *cp;
@@ -41,10 +38,6 @@ struct _FsUpnpSimpleIgdPrivate
gulong avail_handler;
gulong unavail_handler;
- /* Everything below is protected by the mutex */
-
- GMutex *mutex;
- GThread *thread;
guint request_timeout;
};
@@ -70,13 +63,6 @@ enum
FsUpnpSimpleIgdPrivate))
-
-#define FS_UPNP_SIMPLE_IGD_LOCK(self) \
- g_mutex_lock ((self)->priv->mutex)
-#define FS_UPNP_SIMPLE_IGD_UNLOCK(self) \
- g_mutex_unlock ((self)->priv->mutex)
-
-
G_DEFINE_TYPE (FsUpnpSimpleIgd, fs_upnp_simple_igd, G_TYPE_OBJECT);
@@ -112,7 +98,6 @@ fs_upnp_simple_igd_init (FsUpnpSimpleIgd *self)
{
self->priv = FS_UPNP_SIMPLE_IGD_GET_PRIVATE (self);
- self->priv->mutex = g_mutex_new ();
self->priv->request_timeout = 5;
self->priv->service_proxies = g_ptr_array_new ();
@@ -123,8 +108,6 @@ fs_upnp_simple_igd_dispose (GObject *object)
{
FsUpnpSimpleIgd *self = FS_UPNP_SIMPLE_IGD_CAST (object);
- g_return_if_fail (self->priv->thread == NULL);
-
if (self->priv->avail_handler)
g_signal_handler_disconnect (self->priv->cp, self->priv->avail_handler);
self->priv->avail_handler = 0;
@@ -157,8 +140,6 @@ fs_upnp_simple_igd_finalize (GObject *object)
g_ptr_array_free (self->priv->service_proxies, TRUE);
- g_mutex_free (self->priv->mutex);
-
G_OBJECT_CLASS (fs_upnp_simple_igd_parent_class)->finalize (object);
}
@@ -170,9 +151,7 @@ fs_upnp_simple_igd_get_property (GObject *object, guint prop_id,
switch (prop_id) {
case PROP_REQUEST_TIMEOUT:
- FS_UPNP_SIMPLE_IGD_LOCK (self);
g_value_set_uint (value, self->priv->request_timeout);
- FS_UPNP_SIMPLE_IGD_UNLOCK (self);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -189,9 +168,7 @@ fs_upnp_simple_igd_set_property (GObject *object, guint prop_id,
switch (prop_id) {
case PROP_REQUEST_TIMEOUT:
- FS_UPNP_SIMPLE_IGD_LOCK (self);
self->priv->request_timeout = g_value_get_uint (value);
- FS_UPNP_SIMPLE_IGD_UNLOCK (self);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -254,72 +231,3 @@ fs_upnp_simple_igd_new (GMainContext *main_context)
return self;
}
-
-static gpointer
-fs_upnp_simple_igd_loop_func (gpointer data)
-{
- FsUpnpSimpleIgd *self = data;
-
- FS_UPNP_SIMPLE_IGD_LOCK (self);
- self->priv->loop = g_main_loop_new (self->priv->main_context, FALSE);
- FS_UPNP_SIMPLE_IGD_UNLOCK (self);
-
- g_main_loop_run (self->priv->loop);
-
- FS_UPNP_SIMPLE_IGD_LOCK (self);
- g_main_loop_unref (self->priv->loop);
- self->priv->loop = NULL;
- FS_UPNP_SIMPLE_IGD_UNLOCK (self);
-
- return NULL;
-}
-
-FsUpnpSimpleIgd *
-fs_upnp_simple_igd_new_with_thread ()
-{
- FsUpnpSimpleIgd *self = g_object_new (FS_TYPE_UPNP_SIMPLE_IGD, NULL);
-
- self->priv->main_context = g_main_context_new ();
-
- fs_upnp_simple_igd_build (self, NULL);
-
- self->priv->thread = g_thread_create (fs_upnp_simple_igd_loop_func,
- self, TRUE, NULL);
-
- if (!self->priv->thread)
- {
- g_object_unref (self);
- self = NULL;
- }
-
- return self;
-}
-
-
-void
-fs_upnp_simple_igd_stop (FsUpnpSimpleIgd *self)
-{
- GSource *source;
- GMainLoop *loop;
-
- if (!self->priv->thread)
- return;
-
- source = g_idle_source_new ();
-
-
- FS_UPNP_SIMPLE_IGD_LOCK (self);
- loop = g_main_loop_ref (self->priv->loop);
- FS_UPNP_SIMPLE_IGD_UNLOCK (self);
-
- g_source_set_callback (source,
- (GSourceFunc) g_main_loop_quit,
- loop,
- NULL);
-
- g_source_attach (source, self->priv->main_context);
-
- g_thread_join (self->priv->thread);
-
- g_main_loop_unref (loop);
-}
diff --git a/fs-upnp-simple-igd.h b/fs-upnp-simple-igd.h
index 396b319..2fdfadc 100644
--- a/fs-upnp-simple-igd.h
+++ b/fs-upnp-simple-igd.h
@@ -84,9 +84,6 @@ GType fs_upnp_simple_igd_get_type (void);
FsUpnpSimpleIgd *
fs_upnp_simple_igd_new (GMainContext *context);
-FsUpnpSimpleIgd *
-fs_upnp_simple_igd_new_with_thread (void);
-
void
fs_upnp_simple_igd_gather (FsUpnpSimpleIgd *self);
--
1.5.6.5
More information about the farsight-commits
mailing list