static gboolean gs_manager_deactivate (GSManager *manager) { g_return_val_if_fail (manager != NULL, FALSE); g_return_val_if_fail (GS_IS_MANAGER (manager), FALSE); if (! manager->priv->active) { gs_debug ("Trying to deactivate a screensaver that is not active"); return FALSE; } remove_unfade_idle (manager); gs_fade_reset (manager->priv->fade); remove_timers (manager); gs_grab_release (manager->priv->grab); manager_stop_jobs (manager); gs_manager_destroy_windows (manager); /* reset state */ manager->priv->active = FALSE; manager->priv->activate_time = 0; manager->priv->lock_active = FALSE; manager->priv->dialog_up = FALSE; manager->priv->fading = FALSE; return TRUE; }
/** * @brief Calls the on_finished() method of a Lua menu. * @param menu_ref A reference to the menu object. */ void LuaContext::menu_on_finished(int menu_ref) { push_ref(l, menu_ref); on_finished(); remove_timers(-1); // Stop timers associated to this menu. lua_pop(l, 1); }
/** * \brief Calls sol.main.on_finished() if it exists. * * This function is called when the program is reset or stopped. */ void LuaContext::main_on_finished() { push_main(l); on_finished(); remove_timers(-1); // Stop timers associated to sol.main. remove_menus(-1); // Stop menus associated to sol.main. lua_pop(l, 1); }
/** * \brief Calls the on_finished() method of a Lua menu. * \param menu_ref A reference to the menu object. */ void LuaContext::menu_on_finished(const ScopedLuaRef& menu_ref) { push_ref(l, menu_ref); remove_menus(-1); // First, stop children menus if any. on_finished(); remove_timers(-1); // Stop timers associated to this menu. lua_pop(l, 1); }
/** * @brief Calls the on_finished() method of a Lua game. * @param game A game. */ void LuaContext::game_on_finished(Game& game) { push_game(l, game.get_savegame()); on_finished(); remove_timers(-1); // Stop timers and menus associated to this game. remove_menus(-1); lua_pop(l, 1); }
/** * \brief Calls the on_finished() method of a Lua equipment item. * * Does nothing if the method is not defined. * * \param item An equipment item. */ void LuaContext::item_on_finished(EquipmentItem& item) { push_item(l, item); if (userdata_has_field(item, "on_finished")) { on_finished(); } remove_timers(-1); // Stop timers and menus associated to this item. remove_menus(-1); lua_pop(l, 1); }
/** * \brief Calls the on_finished() method of a Lua game if it is defined. * * Also stops timers and menus associated to the game. * * \param game A game. */ void LuaContext::game_on_finished(Game& game) { if (!game.get_savegame().is_known_to_lua()) { return; } push_game(l, game.get_savegame()); if (userdata_has_field(game.get_savegame(), "on_finished")) { on_finished(); } remove_timers(-1); // Stop timers and menus associated to this game. remove_menus(-1); lua_pop(l, 1); }
static void gs_manager_finalize (GObject *object) { GSManager *manager; g_return_if_fail (object != NULL); g_return_if_fail (GS_IS_MANAGER (object)); manager = GS_MANAGER (object); g_return_if_fail (manager->priv != NULL); if (manager->priv->bg != NULL) { g_object_unref (manager->priv->bg); } free_themes (manager); g_free (manager->priv->logout_command); g_free (manager->priv->keyboard_command); g_free (manager->priv->status_message); remove_unfade_idle (manager); remove_timers (manager); gs_grab_release (manager->priv->grab); manager_stop_jobs (manager); gs_manager_destroy_windows (manager); manager->priv->active = FALSE; manager->priv->activate_time = 0; manager->priv->lock_enabled = FALSE; g_object_unref (manager->priv->fade); g_object_unref (manager->priv->grab); g_object_unref (manager->priv->theme_manager); G_OBJECT_CLASS (gs_manager_parent_class)->finalize (object); }
void scheduler() { unsigned int cpu_id = CPUID; struct scheduler_info *si = &(cpu[ cpu_id ].sched); struct thread *tr; int idle; int flip = 0; uint64_t requested_time = TIMESLICE; // We will never go back. set_cpu_flags( cpu_flags() & ~EFLAG_NESTED_TASK ); // Now we're working. acquire_spinlock( &(si->lock_scheduler) ); // Start timing the scheduler stats_time_start( &(cpu[ cpu_id ].st_schedulerTime) ); assert( (cpu_flags() & EFLAG_INTERRUPT) == 0 ); ack_apic(); while (1==1) { // Just show the world that we're still alive. ((char*)0xB8000)[158 - cpu_id * 2] ++ ; /// \todo remove one day // If the garbage collector has work to do, let it run. if ( gc_has_work( cpu_id ) == 0 ) { tr = smk_gc[ cpu_id ]; exec_thread( cpu_id, tr, TIMESLICE, 0 ); stats_time( cpu_id, &(cpu[ cpu_id ].st_systemTime) ); } // Find out when the next timed event is. requested_time = remove_timers( si, cpu[ cpu_id ].st_systemTime.usage ); idle = 0; // Fast queue support if ( flip == 0 ) { tr = get_fast( si ); if ( tr != NULL ) { exec_thread( cpu_id, tr, TIMESLICE, 0 ); stats_time( cpu_id, &(cpu[ cpu_id ].st_systemTime) ); // Maintain CPU time. if ( si->sched_count != 0 ) flip = 1; // Ensure others run continue; } } flip = 0; // Reset of fast queue // If there's nothing to do, do idle. if ( si->sched_count == 0 ) { if ( gc_has_work( cpu_id ) == 0 ) continue; // Al-e-oop! tr = smk_idle[ cpu_id ]; idle = 1; // Safe to wake up when required. } else { tr = si->sched_queue[ si->position ].tr; si->position = (si->position + 1) % si->sched_count; requested_time = TIMESLICE; idle = 0; // Don't interrupt until timeslice is over } // And run the selected thread. exec_thread( cpu_id, tr, requested_time, idle ); stats_time( cpu_id, &(cpu[ cpu_id ].st_systemTime) ); // Maintain CPU time. // // If the previous thread requested a state change, honour it. remove_last( si ); } }