当前位置: 首页>>代码示例>>C++>>正文


C++ ACE_Reactor::owner方法代码示例

本文整理汇总了C++中ACE_Reactor::owner方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_Reactor::owner方法的具体用法?C++ ACE_Reactor::owner怎么用?C++ ACE_Reactor::owner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ACE_Reactor的用法示例。


在下文中一共展示了ACE_Reactor::owner方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: event_loop

static ACE_THR_FUNC_RETURN event_loop (void *arg) {
  ACE_Reactor *reactor = static_cast<ACE_Reactor *> (arg);

  reactor->owner (ACE_OS::thr_self ());
  reactor->run_reactor_event_loop ();
  return 0;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:7,代码来源:WFMO_Reactor_Logging_Server.cpp

示例2: timeout

static void *
worker (void *args)
{
  ACE_Reactor *reactor = (ACE_Reactor *) args;

  reactor->owner (ACE_Thread::self ());

  ACE_Time_Value timeout (4);

  for (;;)
    {
      //ACE_DEBUG ((LM_DEBUG, "(%t) calling handle_events\n"));

      switch (reactor->handle_events (timeout))
	{
	case -1:
	  ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "reactor"), 0);
	  /* NOTREACHED */
	case 0:
	  ACE_ERROR_RETURN ((LM_ERROR, "(%t) timeout\n"), 0);
	  /* NOTREACHED */
	}

      // ACE_DEBUG ((LM_DEBUG, "(%t) done with handle_events\n"));

    }

  ACE_NOTREACHED(return 0);
}
开发者ID:,项目名称:,代码行数:29,代码来源:

示例3: timeout

static void *
worker (void *args)
{
  ACE_Reactor *reactor = reinterpret_cast<ACE_Reactor *> (args);

  // Make this thread the owner of the Reactor's event loop.
  reactor->owner (ACE_Thread::self ());

  // Use a timeout to inform the Reactor when to shutdown.
  ACE_Time_Value timeout (4);

  for (;;)
    switch (reactor->handle_events (timeout))
      {
      case -1:
        ACE_ERROR_RETURN ((LM_ERROR,
                           ACE_TEXT ("(%t) %p\n"),
                           ACE_TEXT ("reactor")),
                          0);
        /* NOTREACHED */
      case 0:
        ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Reactor shutdown\n")));
        return 0;
      }

  ACE_NOTREACHED (return 0);
}
开发者ID:INMarkus,项目名称:ATCD,代码行数:27,代码来源:Reactors_Test.cpp

示例4: while

static void *
dispatch (void *arg)
{
  // every thread must register the same stream to write to file
  if (out_stream)
    {
      ACE_LOG_MSG->set_flags (ACE_Log_Msg::OSTREAM);
      ACE_LOG_MSG->msg_ostream (out_stream);
    }

  ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%t) Dispatcher Thread started!\n")));
  ACE_Reactor *r = reinterpret_cast <ACE_Reactor *> (arg);
  int result;

  r->owner (ACE_OS::thr_self ());

  while (1)
    {
      result = r->handle_events ();

      if (result <= 0)
        ACE_DEBUG ((LM_DEBUG,
                    ACE_TEXT ("Dispatch: handle_events (): %d"),
                    result));
    }

  ACE_NOTREACHED (return 0);
}
开发者ID:arun11299,项目名称:ACE-Code-Examples-Cpp,代码行数:28,代码来源:task_three.cpp

示例5:

static void *run_reactor (void *pReactor)
{
    ACE_Reactor *pLogReactor = (ACE_Reactor *)pReactor;

    pLogReactor->owner(ACE_Thread_Manager::instance ()->thr_self());
    pLogReactor->run_reactor_event_loop ();

    ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) %M run_reactor exit[%N,%l]\n")));
    return 0;
}
开发者ID:0328shijian,项目名称:PSS,代码行数:10,代码来源:Frame_Logging_Strategy.cpp

示例6: event_loop

//for ACE_TP_Reactor
static ACE_THR_FUNC_RETURN event_loop (void *arg)
{
    //ACE_Reactor *reactor = ACE_static_cast(ACE_Reactor *, arg);
    ACE_Reactor *reactor = static_cast< ACE_Reactor *> (arg);

    ACE_DEBUG((LM_INFO, "[%D] ace tp reactor event loop, tid=%d,pid=%d\n"
            , ACE_OS::thr_self ()
            , ACE_OS::getpid()
            ));
    
    reactor->owner(ACE_OS::getpid());
    reactor->run_reactor_event_loop ();
    return 0;
}
开发者ID:cytu0911,项目名称:isgw,代码行数:15,代码来源:ace_app.cpp

示例7: countdown


//.........这里部分代码省略.........
          continue;
        }
      else
        {
          if (TAO_debug_level >= 5)
            {
              TAOLIB_DEBUG ((LM_DEBUG,
                          ACE_TEXT ("TAO (%P|%t) - Leader_Follower[%d]::wait_for_event, ")
                          ACE_TEXT ("Becoming client leader.\n"),
                          t_id));
            }
        }
      // = Leader Code.

      // The only way to reach this point is if we must become the
      // leader, because there is no leader or we have to update to a
      // leader or we are doing nested upcalls in this case we do
      // increase the refcount on the leader in TAO_ORB_Core.

      // Calls this->set_client_leader_thread () on
      // construction and this->reset_client_leader_thread ()
      // on destruction.  Note that this may increase the refcount of
      // the leader.
      { // Scope #5: We are now the client-leader
        TAO_LF_Client_Leader_Thread_Helper client_leader_thread_helper (*this);
        ACE_UNUSED_ARG (client_leader_thread_helper);

        { // Scope #6: release the lock via a reverse lock
          ACE_GUARD_RETURN (ACE_Reverse_Lock<TAO_SYNCH_MUTEX>, rev_mon,
                            this->reverse_lock (), -1);

          // Become owner of the reactor.
          ACE_Reactor *reactor = this->reactor_;
          reactor->owner (ACE_Thread::self ());

          // Run the reactor event loop.
          if (TAO_debug_level >= 5)
            TAOLIB_DEBUG ((LM_DEBUG,
                        ACE_TEXT ("TAO (%P|%t) - Leader_Follower[%d]::wait_for_event,")
                        ACE_TEXT (" (leader) enter reactor event loop\n"),
                        t_id));

          // If we got our event, no need to run the event loop any
          // further.
          while (event->keep_waiting_i ())
          {
            // Run the event loop.
            result = reactor->handle_events (max_wait_time);

            // Did we timeout? If so, stop running the loop.
            if (result == 0 &&
                max_wait_time != 0 &&
                *max_wait_time == ACE_Time_Value::zero)
              break;

            // Other errors? If so, stop running the loop.
            if (result == -1)
              break;

            // Has an event loop thread become available to take over?
            // Yes, we are checking this without the lock, however, if
            // we get a false reading we'll just circle around and
            // become leader again...
            if (this->event_loop_threads_waiting_)
              break;
            // Did we give up leadership?
开发者ID:milan-mpathix,项目名称:ATCD,代码行数:67,代码来源:Leader_Follower.cpp


注:本文中的ACE_Reactor::owner方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。