[farsight2/master] Add bare threading container
Olivier Crête
olivier.crete at collabora.co.uk
Tue Dec 23 15:24:49 PST 2008
---
Makefile | 4 +-
fs-upnp-simple-igd-thread.c | 77 +++++++++++++++++++++++++++++++++++++
fs-upnp-simple-igd-thread.h | 88 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 168 insertions(+), 1 deletions(-)
create mode 100644 fs-upnp-simple-igd-thread.c
create mode 100644 fs-upnp-simple-igd-thread.h
diff --git a/Makefile b/Makefile
index 56b3d40..ccfc049 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,9 @@ LDFLAGS = `pkg-config --libs gupnp-1.0`
fs-upnp-simple-igd.o: fs-upnp-simple-igd-marshal.h fs-upnp-simple-igd.c fs-upnp-simple-igd.h
-test: fs-upnp-simple-igd-marshal.o fs-upnp-simple-igd.o test.o
+fs-upnp-simple-igd-thread.o: fs-upnp-simple-igd-thread.c fs-upnp-simple-igd-thread.h
+
+test: fs-upnp-simple-igd-marshal.o fs-upnp-simple-igd.o test.o fs-upnp-simple-igd-thread.o
clean:
rm -f *.o test
diff --git a/fs-upnp-simple-igd-thread.c b/fs-upnp-simple-igd-thread.c
new file mode 100644
index 0000000..5e94874
--- /dev/null
+++ b/fs-upnp-simple-igd-thread.c
@@ -0,0 +1,77 @@
+/*
+ * Farsight2 - Farsight UPnP IGD abstraction
+ *
+ * Copyright 2008 Collabora Ltd.
+ * @author: Olivier Crete <olivier.crete at collabora.co.uk>
+ * Copyright 2008 Nokia Corp.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+#include "fs-upnp-simple-igd-thread.h"
+
+
+struct _FsUpnpSimpleIgdThreadPrivate
+{
+ GThread *thread;
+ GMainLoop *loop;
+ GMainContext *context;
+};
+
+
+
+
+#define FS_UPNP_SIMPLE_IGD_THREAD_GET_PRIVATE(o) \
+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), FS_TYPE_UPNP_SIMPLE_IGD_THREAD, \
+ FsUpnpSimpleIgdThreadPrivate))
+
+
+G_DEFINE_TYPE (FsUpnpSimpleIgdThread, fs_upnp_simple_igd_thread,
+ FS_TYPE_UPNP_SIMPLE_IGD);
+
+static void fs_upnp_simple_igd_thread_constructed (GObject *object);
+static void fs_upnp_simple_igd_thread_finalize (GObject *object);
+
+
+static void
+fs_upnp_simple_igd_thread_class_init (FsUpnpSimpleIgdThreadClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (FsUpnpSimpleIgdThreadPrivate));
+
+ gobject_class->constructed = fs_upnp_simple_igd_thread_constructed;
+ gobject_class->finalize = fs_upnp_simple_igd_thread_finalize;
+}
+
+
+static void
+fs_upnp_simple_igd_thread_init (FsUpnpSimpleIgdThread *self)
+{
+ self->priv = FS_UPNP_SIMPLE_IGD_THREAD_GET_PRIVATE (self);
+}
+
+static void
+fs_upnp_simple_igd_thread_finalize (GObject *object)
+{
+ //FsUpnpSimpleIgdThread *self = FS_UPNP_SIMPLE_IGD_THREAD_CAST (object);
+}
+
+static void
+fs_upnp_simple_igd_thread_constructed (GObject *object)
+{
+ //FsUpnpSimpleIgdThread *self = FS_UPNP_SIMPLE_IGD_THREAD_CAST (object);
+}
diff --git a/fs-upnp-simple-igd-thread.h b/fs-upnp-simple-igd-thread.h
new file mode 100644
index 0000000..b3253e4
--- /dev/null
+++ b/fs-upnp-simple-igd-thread.h
@@ -0,0 +1,88 @@
+/*
+ * Farsight2 - Farsight UPnP IGD abstraction
+ *
+ * Copyright 2008 Collabora Ltd.
+ * @author: Olivier Crete <olivier.crete at collabora.co.uk>
+ * Copyright 2008 Nokia Corp.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __FS_UPNP_SIMPLE_IGD_THREAD_H__
+#define __FS_UPNP_SIMPLE_IGD_THREAD_H__
+
+#include "fs-upnp-simple-igd.h"
+
+G_BEGIN_DECLS
+
+/* TYPE MACROS */
+#define FS_TYPE_UPNP_SIMPLE_IGD_THREAD \
+ (fs_upnp_simple_igd_thread_get_type ())
+#define FS_UPNP_SIMPLE_IGD_THREAD(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), FS_TYPE_UPNP_SIMPLE_IGD_THREAD, \
+ FsUpnpSimpleIgdThread))
+#define FS_UPNP_SIMPLE_IGD_THREAD_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), FS_TYPE_UPNP_SIMPLE_IGD_THREAD, \
+ FsUpnpSimpleIgdThreadClass))
+#define FS_IS_UPNP_SIMPLE_IGD_THREAD(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), FS_TYPE_UPNP_SIMPLE_IGD_THREAD))
+#define FS_IS_UPNP_SIMPLE_IGD_THREAD_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), FS_TYPE_UPNP_SIMPLE_IGD_THREAD))
+#define FS_UPNP_SIMPLE_IGD_THREAD_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), FS_TYPE_UPNP_SIMPLE_IGD_THREAD, \
+ FsUpnpSimpleIgdThreadClass))
+#define FS_UPNP_SIMPLE_IGD_THREAD_CAST(obj) \
+ ((FsUpnpSimpleIgdThread *) (obj))
+
+typedef struct _FsUpnpSimpleIgdThread FsUpnpSimpleIgdThread;
+typedef struct _FsUpnpSimpleIgdThreadClass FsUpnpSimpleIgdThreadClass;
+typedef struct _FsUpnpSimpleIgdThreadPrivate FsUpnpSimpleIgdThreadPrivate;
+
+/**
+ * FsUpnpSimpleIgdThreadClass:
+ * @parent_class: Our parent
+ *
+ * The Raw UDP component transmitter class
+ */
+
+struct _FsUpnpSimpleIgdThreadClass
+{
+ FsUpnpSimpleIgdClass parent_class;
+
+ /*virtual functions */
+ /*< private >*/
+};
+
+/**
+ * FsUpnpSimpleIgdThread:
+ *
+ * All members are private, access them using methods and properties
+ */
+struct _FsUpnpSimpleIgdThread
+{
+ FsUpnpSimpleIgd parent;
+
+ /*< private >*/
+ FsUpnpSimpleIgdThreadPrivate *priv;
+};
+
+GType fs_upnp_simple_igd_thread_get_type (void);
+
+FsUpnpSimpleIgdThread *
+fs_upnp_simple_igd_thread_new (void);
+
+G_END_DECLS
+
+#endif /* __FS_UPNP_SIMPLE_IGD_THREAD_H__ */
--
1.5.6.5
More information about the farsight-commits
mailing list