本文整理汇总了C++中ThreadPool::assignWork方法的典型用法代码示例。如果您正苦于以下问题:C++ ThreadPool::assignWork方法的具体用法?C++ ThreadPool::assignWork怎么用?C++ ThreadPool::assignWork使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ThreadPool
的用法示例。
在下文中一共展示了ThreadPool::assignWork方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findPasswordByHash
unsigned RainbowTable::findPasswordByHash(unsigned* hash) {
int i;
Chain resultChain;
vector<vector<string> > result;
ThreadPool* myPool = new ThreadPool(THREADS_COUNT);
myPool->initializeThreads();
for (i = CHAIN_LENGTH - 1; i >= 0; --i) {
PasswordFindWorkerThread* myThread =
new PasswordFindWorkerThread(i, hash);
myPool->assignWork(myThread);
if (PasswordFindWorkerThread::result != 0) {
break;
}
}
myPool->destroyPool(1);
delete myPool;
printf("false alarm count: %d\n",
PasswordFindWorkerThread::falseAlarmCount);
if (PasswordFindWorkerThread::result != 0) {
return PasswordFindWorkerThread::result;
}
return 0;
}
示例2: generateTable
void RainbowTable::generateTable(unsigned generateTableRecordsCount) {
puts("Generate Table::start");
unsigned i;
ThreadPool* myPool = new ThreadPool(THREADS_COUNT);
myPool->initializeThreads();
for (i = 0; i < generateTableRecordsCount; i++) {
ChainGeneratingWorkerThread* myThread =
new ChainGeneratingWorkerThread(i);
myPool->assignWork(myThread);
}
myPool->destroyPool(1);
delete myPool;
puts("Generate Table::finish");
}