}
-GTypeModule *
+static GTypeModule *
test_module_new (TestModuleRegisterFunc register_func)
{
TestModule *test_module = g_object_new (TEST_TYPE_MODULE, NULL);
guint val;
};
+static GType dynamic_object_get_type (void);
G_DEFINE_DYNAMIC_TYPE(DynamicObject, dynamic_object, G_TYPE_OBJECT);
static void
/* create threads */
for (i = 0; i < N_THREADS; i++) {
- threads[i] = g_thread_create (ref_unref_thread, (gpointer) DYNAMIC_OBJECT_TYPE, TRUE, NULL);
+ threads[i] = g_thread_new ("test", ref_unref_thread, (gpointer) DYNAMIC_OBJECT_TYPE);
}
/* execute threads */
static void dyn_obj_iface_init (DynIfaceInterface *iface);
+static GType dyn_iface_get_type (void);
G_DEFINE_INTERFACE (DynIface, dyn_iface, G_TYPE_OBJECT)
+static GType dyn_obj_get_type (void);
G_DEFINE_DYNAMIC_TYPE_EXTENDED(DynObj, dyn_obj, G_TYPE_OBJECT, 0,
G_IMPLEMENT_INTERFACE_DYNAMIC(dyn_iface_get_type (), dyn_obj_iface_init))
{
GTypeModule *module;
DynObj *obj;
+ gint val;
module = test_module_new (mod_register);
g_assert (module != NULL);
obj = g_object_new (dyn_obj_get_type (), "foo", 1, NULL);
+ g_object_get (obj, "foo", &val, NULL);
+ g_assert_cmpint (val, ==, 1);
g_object_unref (obj);
}
main (int argc,
char *argv[])
{
- g_thread_init (NULL);
g_test_init (&argc, &argv, NULL);
- g_type_init ();
g_test_add_func ("/GObject/threaded-dynamic-ref-unref-init", test_multithreaded_dynamic_type_init);
g_test_add_func ("/GObject/dynamic-interface-properties", test_dynamic_interface_properties);