#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <pthread.h>
#include <time.h>
#include <glib.h>
#include <glib-object.h>

#define NUM 500

#define THREAD_STACK_SIZE 128

typedef struct _GTest GTest;
typedef struct _GTestClass GTestClass;

struct _GTest
{
  GObject object;
  gint id;
  gint dummy;

  gint count;
};

struct _GTestClass
{
  GObjectClass parent_class;
};

static void g_test_class_init (GTestClass * klass) {}
static void g_test_init (GTest * test) {}


GType
g_test_get_type (void)
{
  
   static GType test_type = 0;
  if(g_once_init_enter(&test_type))
  {
    static const GTypeInfo test_info = {
      sizeof (GTestClass),
      NULL,
      NULL,
      (GClassInitFunc) g_test_class_init,
      NULL,
      NULL,
      sizeof (GTest),
      0,
      (GInstanceInitFunc) g_test_init,
      NULL
    };
    
    GType id  = g_type_register_static (G_TYPE_OBJECT, "GTest", &test_info, 0);
    
    g_once_init_leave(&test_type, id);
  }
  return test_type;
  
}
static void *
thread (void *data)
{
  GType Id =   g_test_get_type();
}


int
main (int argc, char *argv[])
{
  guint i;
  g_thread_init (NULL);
  g_type_init ();

  
  for (i = 0; i < NUM; ++i)
  {
    printf("Creating thread %d\n", i);
    g_thread_create_full(thread,NULL,THREAD_STACK_SIZE, 0, 0, G_THREAD_PRIORITY_NORMAL,NULL);
  }


  return 0;
}
