Exemple #1
0
static void sigterm_handler(int sig)
{
	g_message("%s received", sig == SIGTERM ? "SIGTERM" : "SIGINT");

	if (g_main_loop_is_running(mainloop))
		g_main_loop_quit(mainloop);
}
Exemple #2
0
JNIEXPORT void JNICALL
Java_com_iiordanov_aSPICE_SpiceCommunicator_SpiceClientDisconnect (JNIEnv * env, jobject  obj) {
    maintainConnection = FALSE;

    if (g_main_loop_is_running (mainloop))
        g_main_loop_quit (mainloop);
}
Exemple #3
0
static void
bus_acquired_cb (GDBusConnection *connection,
		 const gchar     *name,
		 gpointer         user_data)
{
	GMainLoop *loop = (GMainLoop *) user_data;
	guint      registration_id;
	GError    *error = NULL;

	if (!introspection_data)
		introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL);

	registration_id = g_dbus_connection_register_object (connection,
							     EV_DBUS_DAEMON_OBJECT_PATH,
							     introspection_data->interfaces[0],
							     &interface_vtable,
							     g_main_loop_ref (loop),
							     (GDestroyNotify) g_main_loop_unref,
							     &error);
	if (registration_id == 0) {
		g_printerr ("Failed to register object: %s\n", error->message);
		g_error_free (error);

		if (g_main_loop_is_running (loop))
			g_main_loop_quit (loop);
	}
}
Exemple #4
0
static gboolean
_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
{
  switch (GST_EVENT_TYPE (event)) {
    case GST_EVENT_EOS:
      if (loop) {
        while (!g_main_loop_is_running (loop));
      }

      have_eos = TRUE;
      if (loop)
        g_main_loop_quit (loop);
      break;
    case GST_EVENT_CAPS:
    {
      GstCaps *caps;

      gst_event_parse_caps (event, &caps);
      _sink_check_caps (pad, caps);
      break;
    }
    default:
      break;
  }

  gst_event_unref (event);

  return TRUE;
}
Exemple #5
0
static gboolean bail_out(GMainLoop* loop)
{
    if (g_main_loop_is_running(loop))
        g_main_loop_quit(loop);

    return FALSE;
}
Exemple #6
0
void svc_accessor::stop()
{
    // stop main loop
    if (main_loop_)
    {
        GMainLoop* loop = main_loop_.get();
        if (loop && g_main_loop_is_running(loop))
        {
            g_main_loop_quit(loop);
            loop_thread_->join();

            // wait for exit thread
            loop_thread_.reset();
        }

        // wait for clear context
        GMainContext* main_context = g_main_loop_get_context(loop);
        while(!g_main_context_acquire(main_context))
                sched_yield();

        g_main_context_release(main_context_.get());
        main_context_.reset();
        main_loop_.reset();
        // unregister service
        if (svc_)
            svc_.reset();
    }
}
Exemple #7
0
static void clipboard_agent_connected(RunInfo *ri)
{
    g_warning("agent status changed, cancel clipboard request");

    if (g_main_loop_is_running(ri->loop))
        g_main_loop_quit(ri->loop);
}
/**
 * gst_gl_window_is_running:
 * @window: a #GstGLWindow
 *
 * Whether the runloop is running
 *
 * Since: 1.4
 */
gboolean
gst_gl_window_is_running (GstGLWindow * window)
{
  GstGLWindowPrivate *priv = window->priv;
  return priv->alive && (!priv->loop
      || g_main_loop_is_running (window->priv->loop));
}
Exemple #9
0
static gboolean finish_loading(DomDocumentFixture* fixture)
{
    if (g_main_loop_is_running(fixture->loop))
        g_main_loop_quit(fixture->loop);

    return FALSE;
}
Exemple #10
0
static void signals_handler (int signum)
{
	if (mainloop && g_main_loop_is_running (mainloop))
	{
		g_main_loop_quit (mainloop);
	}
}
Exemple #11
0
static gboolean
app_exit_after_callback (Gimp       *gimp,
                         gboolean    kill_it,
                         GMainLoop **loop)
{
  if (gimp->be_verbose)
    g_print ("EXIT: %s\n", G_STRFUNC);

  /*
   *  In stable releases, we simply call exit() here. This speeds up
   *  the process of quitting GIMP and also works around the problem
   *  that plug-ins might still be running.
   *
   *  In unstable releases, we shut down GIMP properly in an attempt
   *  to catch possible problems in our finalizers.
   */

#ifdef GIMP_UNSTABLE

  if (g_main_loop_is_running (*loop))
    g_main_loop_quit (*loop);

  *loop = NULL;

#else

  gegl_exit ();

  exit (EXIT_SUCCESS);

#endif

  return FALSE;
}
gboolean my_callback(int* data)
{
	static int i = 100;
	int depth;

	//checks g_main_loop_is_running
	g_assert(g_main_loop_is_running(loop));

	depth = g_main_depth();

	//checks g_main_depth
	g_assert(depth == 1);

	i--;

	//printf("%d\n",i);

	if(i<0)
	{
		e1_complete = TRUE;
		quit();
		return FALSE;
	}
	else
	{
		++(*data);
		return TRUE;
	}
}
Exemple #13
0
static gboolean
do_itsignaler_cb (ITSignaler *its, GMainLoop *loop)
{
	if (g_main_loop_is_running (loop))
		g_main_loop_quit (loop);
	return TRUE; /* keep */
}
Exemple #14
0
static gboolean
do_timer_cb (GMainLoop *loop)
{
	if (g_main_loop_is_running (loop))
		g_main_loop_quit (loop);
	return FALSE; /* remove timer */
}
Exemple #15
0
void tvr_stop_recorder_pipeline(recorder_data *rd){

	if(rd){
		if(rd->priv){
			gst_element_set_state(rd->priv->pipeline, GST_STATE_NULL);
			if(g_main_loop_is_running(rd->priv->loop)){
				g_debug("Stopping GMainLoop and unref \n");
				g_main_loop_quit(rd->priv->loop);
				g_main_loop_unref(rd->priv->loop);
			} else {
				g_main_loop_unref(rd->priv->loop);
			}
	
	/* Pipeline has all elements, so unrefing it results
	 * in unrefing the other elements which are in it 
	 */
			g_debug("pipeline cleaned up \n");
			g_object_unref(GST_OBJECT(rd->priv->pipeline));
			

			if(rd->priv){
				g_free(rd->priv);
				rd->priv = NULL;
			}
		}
	}
}
Exemple #16
0
static void
do_exit (GMainLoop *loop,
	 GObject   *object)
{
	if (g_main_loop_is_running (loop))
		g_main_loop_quit (loop);
}
Exemple #17
0
static void
daemon_shutdown (GVfsDaemon *daemon,
		 GMainLoop  *loop)
{
  if (g_main_loop_is_running (loop))
    g_main_loop_quit (loop);
}
Exemple #18
0
/**
 * Stops Metacity. This tells the event loop to stop processing; it is rather
 * dangerous to use this rather than meta_restart() because this will leave
 * the user with no window manager. We generally do this only if, for example,
 * the session manager asks us to; we assume the session manager knows what
 * it's talking about.
 *
 * \param code The success or failure code to return to the calling process.
 */
void
meta_quit (MetaExitCode code)
{
  meta_exit_code = code;

  if (g_main_loop_is_running (meta_main_loop))
    g_main_loop_quit (meta_main_loop);
}
static void navfocus_main_loop_run(void)
{
	loop = g_main_loop_new (NULL, TRUE);
	if (g_main_loop_is_running (loop))
	{
		g_main_loop_run (loop);
	}
}
Exemple #20
0
static void event_glib_main_loop_run(void)
{
	loop = g_main_loop_new (NULL, TRUE);
	if (g_main_loop_is_running (loop))
	{
		g_main_loop_run (loop);
	}
}
static void _cookie_permission_manager_on_infobar_destroy(GtkWidget* inInfobar,
															gpointer inUserData)
{
	CookiePermissionManagerModalInfobar		*modalInfo=(CookiePermissionManagerModalInfobar*)inUserData;

	/* Quit main loop */
	if(g_main_loop_is_running(modalInfo->mainLoop)) g_main_loop_quit(modalInfo->mainLoop);
}
Exemple #22
0
static void * main_thread(void *app) {

	ms_sleep(100);
	
	while (mainloop && g_main_loop_is_running (mainloop)) {
		myMainLoop(app);
	}
}
Exemple #23
0
void RunLoop::stop()
{
    // The innermost main loop should always be there.
    ASSERT(!m_runLoopMainLoops.isEmpty());
    GRefPtr<GMainLoop> lastMainLoop = m_runLoopMainLoops.last();
    if (g_main_loop_is_running(lastMainLoop.get()))
        g_main_loop_quit(lastMainLoop.get());
}
Exemple #24
0
RunLoop::~RunLoop()
{
    for (int i = m_runLoopMainLoops.size() - 1; i >= 0; --i) {
        if (!g_main_loop_is_running(m_runLoopMainLoops[i].get()))
            continue;
        g_main_loop_quit(m_runLoopMainLoops[i].get());
    }
}
Exemple #25
0
static void agent_released(OBEXAgent *agent, gpointer data)
{
	g_assert(data != NULL);
	GMainLoop *mainloop = data;

	if (g_main_loop_is_running(mainloop))
		g_main_loop_quit(mainloop);
}
Exemple #26
0
static void quit_handler(int sig)
{
    g_debug("recieved signal num %d, quitting", sig);

    if (g_main_loop_is_running(ga_state->main_loop)) {
        g_main_loop_quit(ga_state->main_loop);
    }
}
Exemple #27
0
  /* User hit a mouse button in the Output drawing area, so quit the loop
     |  and the cursor values when the button was pressed will be used.
   */
static gboolean
loop_button_press_cb (GtkWidget * drawing_area, GdkEventButton * ev,
		      GMainLoop ** loop)
{
  if (g_main_loop_is_running (*loop))
    g_main_loop_quit (*loop);
  ghid_note_event_location (ev);
  return TRUE;
}
gpointer mmsvc_core_main_loop(gpointer data)
{
	while (1) {
		sleep(LOG_SLEEP_TIMER);
		LOGD("polling %d\n", g_main_loop_is_running(g_loop));
	}

	return NULL;
}
/**
 * mcm_calibrate_dialog_run:
 **/
GtkResponseType
mcm_calibrate_dialog_run (McmCalibrateDialog *calibrate_dialog)
{
	if (g_main_loop_is_running (calibrate_dialog->priv->loop))
		egg_error ("you can't call this recursively");

	g_main_loop_run (calibrate_dialog->priv->loop);
	return calibrate_dialog->priv->response;
}
Exemple #30
-1
void RunLoop::run()
{
    RunLoop& runLoop = RunLoop::current();
    GMainContext* mainContext = runLoop.m_mainContext.get();

    // The innermost main loop should always be there.
    ASSERT(!runLoop.m_mainLoops.isEmpty());

    GMainLoop* innermostLoop = runLoop.m_mainLoops[0].get();
    if (!g_main_loop_is_running(innermostLoop)) {
        g_main_context_push_thread_default(mainContext);
        g_main_loop_run(innermostLoop);
        g_main_context_pop_thread_default(mainContext);
        return;
    }

    // Create and run a nested loop if the innermost one was already running.
    GMainLoop* nestedMainLoop = g_main_loop_new(mainContext, FALSE);
    runLoop.m_mainLoops.append(adoptGRef(nestedMainLoop));

    g_main_context_push_thread_default(mainContext);
    g_main_loop_run(nestedMainLoop);
    g_main_context_pop_thread_default(mainContext);

    runLoop.m_mainLoops.removeLast();
}