binding: Add a default marshaller for the closure API
[platform/upstream/glib.git] / gobject / tests / threadtests.c
index eabbe05..c3b0171 100644 (file)
 #include <glib.h>
 #include <glib-object.h>
 
-#define G_DEFINE_INTERFACE(TN, t_n, T_P)                   G_DEFINE_INTERFACE_WITH_CODE(TN, t_n, T_P, ;)
-#define G_DEFINE_INTERFACE_WITH_CODE(TN, t_n, T_P, _C_)     _G_DEFINE_INTERFACE_EXTENDED_BEGIN(TN, t_n, T_P) {_C_;} _G_DEFINE_INTERFACE_EXTENDED_END()
-/* _default_init, ##Interface, if(TYPE_PREREQ); */
-#define _G_DEFINE_INTERFACE_EXTENDED_BEGIN(TypeName, type_name, TYPE_PREREQ) \
-static void type_name##_default_init  (TypeName##Interface *klass); \
-GType \
-type_name##_get_type (void) \
-{ \
-  static volatile gsize g_define_type_id__volatile = 0; \
-  if (g_once_init_enter (&g_define_type_id__volatile))  \
-    { \
-      GType g_define_type_id = \
-        g_type_register_static_simple (G_TYPE_INTERFACE, \
-                                       g_intern_static_string (#TypeName), \
-                                       sizeof (TypeName##Interface), \
-                                       (GClassInitFunc) type_name##_default_init, \
-                                       0, \
-                                       (GInstanceInitFunc) NULL, \
-                                       (GTypeFlags) 0); \
-      if (TYPE_PREREQ) \
-        g_type_interface_add_prerequisite (g_define_type_id, TYPE_PREREQ); \
- { /* custom code follows */
-#define _G_DEFINE_INTERFACE_EXTENDED_END()        \
-        /* following custom code */             \
- }                                              \
-      g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); \
- }                                               \
-  return g_define_type_id__volatile;                 \
-} /* closes type_name##_get_type() */
-
 static volatile int mtsafe_call_counter = 0; /* multi thread safe call counter */
 static int          unsafe_call_counter = 0; /* single-threaded call counter */
 
@@ -64,9 +34,9 @@ call_counter_init (gpointer tclass)
   for (i = 0; i < NUM_COUNTER_INCREMENTS; i++)
     {
       int saved_unsafe_call_counter = unsafe_call_counter;
-      g_atomic_int_add (&mtsafe_call_counter, 1); // real call count update
-      g_thread_yield(); // let concurrent threads corrupt the unsafe_call_counter state
-      unsafe_call_counter = 1 + saved_unsafe_call_counter; // non-atomic counter update
+      g_atomic_int_add (&mtsafe_call_counter, 1); /* real call count update */
+      g_thread_yield(); /* let concurrent threads corrupt the unsafe_call_counter state */
+      unsafe_call_counter = 1 + saved_unsafe_call_counter; /* non-atomic counter update */
     }
 }
 
@@ -169,7 +139,7 @@ static void
 prop_tester_init (PropTester* t)
 {
   if (t->name == NULL)
-    ; // neds unit test framework initialization: g_test_bug ("race initializing properties");
+    ; /* neds unit test framework initialization: g_test_bug ("race initializing properties"); */
 }
 static void
 prop_tester_set_property (GObject        *object,