本文整理汇总了C++中RelayRunner类的典型用法代码示例。如果您正苦于以下问题:C++ RelayRunner类的具体用法?C++ RelayRunner怎么用?C++ RelayRunner使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RelayRunner类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getForeRunner
/**
* Start the race.
*/
void
RelayRace::run(void) {
trace::Call *call;
call = parser.parse_call();
if (!call) {
/* Nothing to do */
return;
}
/* If the user wants to loop we need to get a bookmark target. We
* usually get this after replaying a call that ends a frame, but
* for a trace that has only one frame we need to get it at the
* beginning. */
if (loopOnFinish) {
parser.getBookmark(lastFrameStart);
}
RelayRunner *foreRunner = getForeRunner();
if (call->thread_id == 0) {
/* We are the forerunner thread, so no need to pass baton */
foreRunner->baton = call;
} else {
passBaton(call);
}
/* Start the forerunner thread */
foreRunner->runRace();
}
示例2:
/**
* Called by the fore runner after finish line to stop all other runners.
*/
void
RelayRace::stopRunners(void) {
std::vector<RelayRunner*>::const_iterator it;
for (it = runners.begin() + 1; it != runners.end(); ++it) {
RelayRunner* runner = *it;
if (runner) {
runner->finishRace();
}
}
}
示例3: getForeRunner
/**
* Start the race.
*/
void
RelayRace::run(void) {
trace::Call *call;
call = parser->parse_call();
if (!call) {
/* Nothing to do */
return;
}
RelayRunner *foreRunner = getForeRunner();
if (call->thread_id == 0) {
/* We are the forerunner thread, so no need to pass baton */
foreRunner->baton = call;
} else {
passBaton(call);
}
/* Start the forerunner thread */
foreRunner->runRace();
}
示例4: getRunner
/**
* Pass the baton (i.e., the call) to the appropriate thread.
*/
void
RelayRace::passBaton(trace::Call *call) {
if (0) std::cerr << "switching to thread " << call->thread_id << "\n";
RelayRunner *runner = getRunner(call->thread_id);
runner->receiveBaton(call);
}