Example #1
0
template<class PROXY, class COLLECTION, class ITERATOR, ACE_SYNCH_DECL> int
TAO_ESF_Delayed_Changes<PROXY,COLLECTION,ITERATOR,ACE_SYNCH_USE>::
    execute_delayed_operations (void)
{
  while (!this->command_queue_.is_empty ())
    {
      ACE_Command_Base* command = 0;
      this->command_queue_.dequeue_head (command);

      command->execute ();

      delete command;
    }
  return 0;
}
Example #2
0
template<class TQ> int
ACE_Thread_Timer_Queue_Adapter<TQ>::dispatch_commands (void)
{
  // Serialize access to the command queue.
  ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, guard, this->command_mutex_, -1);

  // loop through the enqueued commands
  ACE_Command_Base *cmd = 0;
  while (command_queue_.dequeue_head (cmd) == 0)
    if (cmd)
      {
        cmd->execute ();
        delete cmd;
      }

  return 0;
}
Example #3
0
template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> int
ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::expire_single (
    ACE_Command_Base & pre_dispatch_command)
{
  ACE_TRACE ("ACE_Timer_Queue_T::expire_single");
  ACE_Timer_Node_Dispatch_Info_T<TYPE> info;
  ACE_Time_Value cur_time;
  {
    // Create a scope for the lock ...
    ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1));

    if (this->is_empty ())
      return 0;

    // Get the current time
    cur_time = this->gettimeofday_static () + this->timer_skew ();

    // Look for a node in the timer queue whose timer <= the present
    // time.
    if (!this->dispatch_info_i (cur_time, info))
      {
        return 0;
      }
  }
  // We do not need the lock anymore, all these operations take place
  // with local variables.
  const void *upcall_act = 0;

  // Preinvoke (handles refcount if needed, etc.)
  this->preinvoke (info, cur_time, upcall_act);

  // Release the token before expiration upcall.
  pre_dispatch_command.execute();

  // call the functor
  this->upcall (info, cur_time);

  // Postinvoke (undo refcount if needed, etc.)
  this->postinvoke (info, cur_time, upcall_act);

  // We have dispatched a timer
  return 1;
}