本文整理汇总了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;
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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?