Beispiel #1
0
void
ags_gui_task_thread_run(AgsThread *thread)
{
  AgsGuiThread *gui_thread;
  GMainContext *main_context;

  gui_thread = AGS_AUDIO_LOOP(AGS_MAIN(AGS_DEVOUT(thread->devout)->ags_main)->main_loop)->gui_thread;
  main_context = g_main_context_default();

  if(!g_main_context_acquire(main_context)){
    gboolean got_ownership = FALSE;

    while(!got_ownership){
      got_ownership = g_main_context_wait(main_context,
					  &(gui_thread->cond),
					  &(gui_thread->mutex));
    }
  }

  gdk_threads_enter();
  gdk_threads_leave();

  g_main_context_iteration(main_context, FALSE);

  AGS_THREAD_CLASS(ags_gui_task_thread_parent_class)->run(thread);

  g_main_context_release(main_context);
}
Beispiel #2
0
static int glib_acquire(glib_glue_t *glue)
{
    if (g_main_context_acquire(glue->mc))
        return TRUE;

    while (!g_main_context_wait(glue->mc, &glue->gcnd, &glue->gmtx))
        ;

    return TRUE;
}
Beispiel #3
0
void
grustna_main_loop_run_thread_local (GMainLoop *loop)
{
  GMainContext *context;
  gboolean context_acquired;

  context = g_main_loop_get_context (loop);

  context_acquired = g_main_context_acquire (context);
  while (!context_acquired)
    context_acquired = g_main_context_wait (context,
                                            &rust_context_released_cond,
                                            &rust_context_mutex);

  g_main_context_push_thread_default (context);
  g_main_loop_run (loop);
  g_main_context_pop_thread_default (context);

  g_main_context_release (context);
}