if (ret == EAGAIN)
{
g_set_error (error, G_THREAD_ERROR, G_THREAD_ERROR_AGAIN,
- "Error creating thread: %s", g_strerror (ret));
- return thread;
+ "Error creating thread: %s", g_strerror (ret));
+ g_slice_free (GRealThread, thread);
+ return NULL;
}
posix_check_err (ret, "pthread_create");
"Error creating thread: %s", win_error);
g_free (retval);
g_free (win_error);
- return thread;
+ g_slice_free (GRealThread, thread);
+ return NULL;
}
*(GThreadData **) &(thread->system_thread) = retval;
gsize stack_size,
GError **error)
{
- GRealThread *result;
- GError *local_error = NULL;
+ GRealThread *thread;
g_return_val_if_fail (func != NULL, NULL);
G_LOCK (g_thread_new);
- result = g_system_thread_new (proxy, stack_size, joinable, &local_error);
- result->thread.joinable = joinable;
- result->thread.func = func;
- result->thread.data = data;
- result->name = name;
- G_UNLOCK (g_thread_new);
-
- if (local_error)
+ thread = g_system_thread_new (proxy, stack_size, joinable, error);
+ if (thread)
{
- g_propagate_error (error, local_error);
- g_system_thread_free (result);
- return NULL;
+ thread->thread.joinable = joinable;
+ thread->thread.func = func;
+ thread->thread.data = data;
+ thread->name = name;
}
+ G_UNLOCK (g_thread_new);
- return (GThread*) result;
+ return (GThread*) thread;
}
/**