#include "gqueue.h"
#include "gstrfuncs.h"
#include "gtestutils.h"
-#include "gthreadprivate.h"
#ifdef G_OS_WIN32
#include "gwin32.h"
return default_main_context;
}
-static GStaticPrivate thread_context_stack = G_STATIC_PRIVATE_INIT;
-
static void
free_context_stack (gpointer data)
{
context = g_queue_pop_head (stack);
g_main_context_release (context);
if (context)
- g_main_context_unref (context);
+ g_main_context_unref (context);
}
g_queue_free (stack);
}
+static GPrivate thread_context_stack = G_PRIVATE_INIT (free_context_stack);
+
/**
* g_main_context_push_thread_default:
* @context: a #GMainContext, or %NULL for the global default context
else if (context)
g_main_context_ref (context);
- stack = g_static_private_get (&thread_context_stack);
+ stack = g_private_get (&thread_context_stack);
if (!stack)
{
stack = g_queue_new ();
- g_static_private_set (&thread_context_stack, stack,
- free_context_stack);
+ g_private_set (&thread_context_stack, stack);
}
g_queue_push_head (stack, context);
if (context == g_main_context_default ())
context = NULL;
- stack = g_static_private_get (&thread_context_stack);
+ stack = g_private_get (&thread_context_stack);
g_return_if_fail (stack != NULL);
g_return_if_fail (g_queue_peek_head (stack) == context);
{
GQueue *stack;
- stack = g_static_private_get (&thread_context_stack);
+ stack = g_private_get (&thread_context_stack);
if (stack)
return g_queue_peek_head (stack);
else
static GMainDispatch *
get_dispatch (void)
{
- static GStaticPrivate depth_private = G_STATIC_PRIVATE_INIT;
- GMainDispatch *dispatch = g_static_private_get (&depth_private);
+ static GPrivate depth_private = G_PRIVATE_INIT (g_main_dispatch_free);
+ GMainDispatch *dispatch;
+
+ dispatch = g_private_get (&depth_private);
+
if (!dispatch)
{
dispatch = g_slice_new0 (GMainDispatch);
- g_static_private_set (&depth_private, dispatch, g_main_dispatch_free);
+ g_private_set (&depth_private, dispatch);
}
return dispatch;