Example #1
0
static void
handle_alarm_going_off (void)
{
  int interval_id;

  /* If asynch. timeouts are blocked, then don't do anything now,
     but make this function get called again next QUIT.

     #### This is a bit inefficient because there will be function call
     overhead each time QUIT occurs. */

  if (!NILP (Vinhibit_quit))
    {
      something_happened = 1;
      alarm_happened = 1;
      return;
    }

  interval_id = pop_low_level_timeout (&async_timer_queue, 0);

  reset_interval_timer ();
  if (alarm_happened_while_emacs_was_blocking)
    {
      alarm_happened_while_emacs_was_blocking = 0;
      waiting_for_user_input_p = 1;
    }
  event_stream_deal_with_async_timeout (interval_id);
  waiting_for_user_input_p = 0;
}
Example #2
0
void
event_stream_remove_async_timeout (int id)
{
  int first = (async_timer_queue && async_timer_queue->id == id);
  remove_low_level_timeout (&async_timer_queue, id);

  /* If we removed the timeout from the head of the queue, then
     we need to reset the interval timer right now. */
  if (first)
    reset_interval_timer ();
}
Example #3
0
static void
start_async_timeouts (void)
{
  assert (async_timer_suppress_count > 0);
  async_timer_suppress_count--;
  if (async_timer_suppress_count == 0)
    {
      /* Some callers turn off async timeouts and then use the alarm
	 for their own purposes; so reinitialize everything. */
      signal (SIGALRM, alarm_signal);
      reset_interval_timer ();
    }
}
Example #4
0
int
event_stream_add_async_timeout (EMACS_TIME thyme)
{
  int id = add_low_level_timeout (&async_timer_queue, thyme);

  /* If this timeout is at the head of the queue, then we need to
     set the timer right now for this timeout.  Otherwise, things
     are fine as-is; after the timers ahead of us are signalled,
     the timer will be set for us. */

  if (async_timer_queue->id == id)
    reset_interval_timer ();

  return id;
}
Example #5
0
 void invoke(const std::string& message)
 {
    reset_interval_timer();
    m_callback(message);
 }