本文整理汇总了C++中iceutil::ThreadPtr::run方法的典型用法代码示例。如果您正苦于以下问题:C++ ThreadPtr::run方法的具体用法?C++ ThreadPtr::run怎么用?C++ ThreadPtr::run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iceutil::ThreadPtr
的用法示例。
在下文中一共展示了ThreadPtr::run方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: catch
static void*
startHook(void* arg)
{
//
// Ensure that the thread doesn't go away until run() has
// completed.
//
IceUtil::ThreadPtr thread;
try
{
IceUtil::Thread* rawThread = static_cast<IceUtil::Thread*>(arg);
thread = rawThread;
//
// See the comment in IceUtil::Thread::start() for details.
//
rawThread->__decRef();
thread->run();
}
catch(...)
{
if(!thread->name().empty())
{
consoleErr << thread->name() << " terminating" << endl;
}
std::terminate();
}
thread->_done();
return 0;
}
示例2: catch
static void*
startHook(void* arg)
{
//
// Ensure that the thread doesn't go away until run() has
// completed.
//
IceUtil::ThreadPtr thread;
try {
IceUtil::Thread* rawThread = static_cast<IceUtil::Thread*> (arg);
thread = rawThread;
//
// See the comment in IceUtil::Thread::start() for details.
//
rawThread->__decRef();
thread->run();
} catch (const IceUtil::Exception& e) {
cerr << "IceUtil::Thread::run(): uncaught exception: ";
cerr << e << endl;
} catch (...) {
cerr << "IceUtil::Thread::run(): uncaught exception" << endl;
}
thread->_done();
return 0;
}
示例3: startHook
static unsigned int
WINAPI startHook(void* arg)
{
// Ensure that the thread doesn't go away until run() has
// completed.
//
IceUtil::ThreadPtr thread;
try
{
IceUtil::Thread* rawThread = static_cast<IceUtil::Thread*>(arg);
//
// Ensure that the thread doesn't go away until run() has
// completed.
//
thread = rawThread;
//
// Initialize the random number generator in each thread on
// Windows (the rand() seed is thread specific).
//
unsigned int seed = static_cast<unsigned int>(IceUtil::Time::now().toMicroSeconds());
srand(seed ^ static_cast<unsigned int>(hash<thread::id>()(thread->getThreadControl().id())));
//
// See the comment in IceUtil::Thread::start() for details.
//
rawThread->__decRef();
pthread_setname_np(thread->name().c_str());
thread->run();
}
catch(...)
{
if(!thread->name().empty())
{
cerr << thread->name() << " terminating" << endl;
}
std::terminate();
}
thread->_done();
return 0;
}
示例4: startHook
static unsigned int
WINAPI startHook(void* arg)
{
// Ensure that the thread doesn't go away until run() has
// completed.
//
IceUtil::ThreadPtr thread;
try
{
IceUtil::Thread* rawThread = static_cast<IceUtil::Thread*>(arg);
//
// Initialize the random number generator in each thread.
//
unsigned int seed = static_cast<unsigned int>(IceUtil::Time::now().toMicroSeconds());
srand(seed);
//
// Ensure that the thread doesn't go away until run() has
// completed.
//
thread = rawThread;
//
// See the comment in IceUtil::Thread::start() for details.
//
rawThread->__decRef();
thread->run();
}
catch(const IceUtil::Exception& e)
{
cerr << "IceUtil::Thread::run(): uncaught exception: ";
cerr << e << endl;
}
catch(...)
{
cerr << "IceUtil::Thread::run(): uncaught exception" << endl;
}
thread->_done();
return 0;
}