本文整理汇总了C++中ACE_Thread_Manager::thr_self方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_Thread_Manager::thr_self方法的具体用法?C++ ACE_Thread_Manager::thr_self怎么用?C++ ACE_Thread_Manager::thr_self使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACE_Thread_Manager
的用法示例。
在下文中一共展示了ACE_Thread_Manager::thr_self方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: timeout
//
// Now the svc() method where everything interesting happens.
//
int
ReactorTask::svc()
{
MIRO_DBG_OSTR(MIRO, LL_DEBUG,
"[Miro::ReactorTask] 0x" << (void*)this <<
" starts in thread " << ACE_Thread::self());
ACE_Time_Value timeout(0, 100000); // wait for 100 msec
ACE_Time_Value delta; // uninitialized time value
// set the given thread scheduling policy
if (ACE_OS::sched_params(schedp_) == -1) {
MIRO_LOG_OSTR(LL_ERROR, "[Miro::ReactorTask] Could not set sched parameters." << std::endl
<< "[Miro::ReactorTask] Maybe suid root is missing." << std::endl
<< "[Miro::ReactorTask] Will work on default scheduling policy." << std::endl);
}
// set the thread to be the owner of the reactor,
//otherwise we will get errors
reactor_.owner(ACE_OS::thr_self());
ACE_Thread_Manager * mgr = this->thr_mgr();
try {
while (!mgr->testcancel(mgr->thr_self())) {
// set delta to timeout
// handle_events decrements the timeout
delta = timeout;
// trigger message handling
reactor_.handle_events(delta);
}
}
catch (const Miro::Exception& e) {
MIRO_LOG_OSTR(LL_ERROR, "ReactorTask.handleMessage() - Uncaught Miro exception: " << e << std::endl);
conditionalShutdown();
}
catch (...) {
MIRO_LOG(LL_ERROR, "[Miro::HwReactor] task terminated due to unknown exception.");
conditionalShutdown();
}
return 0;
}