Sun Sep 17 2000 Elliot Lee <sopwith@redhat.com> Define g_alloca() as an
[platform/upstream/glib.git] / gthread.c
index f644f70..034e771 100644 (file)
--- a/gthread.c
+++ b/gthread.c
    (memcpy (&dest, &src, GLIB_SIZEOF_SYSTEM_THREAD))
 #endif /* GLIB_SIZEOF_SYSTEM_THREAD == SIZEOF_VOID_P */
 
+GQuark 
+g_thread_error_quark()
+{
+  static GQuark quark;
+  if (!quark)
+    quark = g_quark_from_static_string ("g_thread_error");
+  return quark;
+}
+
 typedef struct _GRealThread GRealThread;
 struct  _GRealThread
 {
@@ -97,7 +106,7 @@ GThreadFunctions g_thread_functions_for_glib_use = {
   NULL,                                        /* private_set */
   (void(*)(GThreadFunc, gpointer, gulong, 
           gboolean, gboolean, GThreadPriority, 
-          gpointer))g_thread_fail,            /* thread_create */
+          gpointer, GError**))g_thread_fail,  /* thread_create */
   NULL,                                        /* thread_yield */
   NULL,                                        /* thread_join */
   NULL,                                        /* thread_exit */
@@ -381,10 +390,11 @@ g_thread_create (GThreadFunc               thread_func,
                 gulong                  stack_size,
                 gboolean                joinable,
                 gboolean                bound,
-                GThreadPriority         priority)
+                GThreadPriority         priority,
+                GError                **error)
 {
   GRealThread* result = g_new (GRealThread, 1);
-
+  GError *local_error = NULL;
   g_return_val_if_fail (thread_func, NULL);
   
   result->thread.joinable = joinable;
@@ -394,10 +404,18 @@ g_thread_create (GThreadFunc               thread_func,
   result->arg = arg;
   result->private_data = NULL; 
   G_LOCK (g_thread_create);
-  G_THREAD_UF (thread_create, (g_thread_create_proxy, result, stack_size, 
-                              joinable, bound, priority,
-                              &result->system_thread));
+  G_THREAD_UF (thread_create, (g_thread_create_proxy, result, 
+                              stack_size, joinable, bound, priority,
+                              &result->system_thread, &local_error));
   G_UNLOCK (g_thread_create);
+
+  if (local_error)
+    {
+      g_propagate_error (error, local_error);
+      g_free (result);
+      return NULL;
+    }
+
   return (GThread*) result;
 }