Esempio n. 1
0
File: kiro-sb.c Progetto: IMCG/kiro
gboolean
idle_func (KiroSbPrivate *priv)
{
    if (priv->close_signal) {
        g_main_loop_quit (priv->main_loop);
        /*main_thread will do the unref upon exit*/
        priv->main_loop = NULL;
        g_debug ("Main loop quit");
        return G_SOURCE_REMOVE;
    }

    if (TRUE == priv->freeze)
        return G_SOURCE_CONTINUE;

    struct KiroTrbInfo *header = (struct KiroTrbInfo *)kiro_trb_get_raw_buffer (priv->trb);
    gulong old_offset = header->offset;
    kiro_client_sync_partial (priv->client, 0, sizeof(struct KiroTrbInfo), 0);
    kiro_trb_refresh (priv->trb);
    if ((old_offset != header->offset) && 0 < header->offset) {
        gulong offset = (gulong) (kiro_trb_get_element (priv->trb, -1) - kiro_trb_get_raw_buffer (priv->trb));
        kiro_client_sync_partial (priv->client, offset, kiro_trb_get_element_size (priv->trb), offset);
        g_hook_list_invoke_check (&(priv->callbacks), FALSE);
    }

    return G_SOURCE_CONTINUE;
}
Esempio n. 2
0
/* Run each process being managed by the process manager.  DELTA_T is
   the time since this was last called, according to the timer in the
   main loop.  */
int
pm_iterate (double delta_t)
{
    gint proc_count = 0;
    GHook *proc;

    pm_set_delta_time (delta_t);

    /* Call all the processes being managed by the process manager,
       skipping any slow processes that aren't complete from the last
       iteration.  (Any process that returns FALSE is culled.) */
    g_hook_list_invoke_check (pm, FALSE);
    proc = g_hook_first_valid (pm, TRUE);

	/* Count the number of processes being managed by the process
	   manager. */
    while (proc != NULL)
    {
        proc_count ++;
        proc = g_hook_next_valid (pm, proc, TRUE);
    }
    return proc_count;
}