本文整理汇总了C++中ThreadPool::GetOutput方法的典型用法代码示例。如果您正苦于以下问题:C++ ThreadPool::GetOutput方法的具体用法?C++ ThreadPool::GetOutput怎么用?C++ ThreadPool::GetOutput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ThreadPool
的用法示例。
在下文中一共展示了ThreadPool::GetOutput方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
// Update is run in the user thread
virtual bool Update(void)
{
if (threadPool.HasOutputFast() && threadPool.HasOutput())
{
AutopatcherClientThreadInfo *threadInfo = threadPool.GetOutput();
threadInfo->onFileStruct.context.op=threadInfo->result;
switch (threadInfo->result)
{
case PC_NOTICE_WILL_COPY_ON_RESTART:
{
client->CopyAndRestart(threadInfo->onFileStruct.fileName);
if (threadInfo->onFileStruct.context.op==PC_WRITE_FILE)
{
// Regular file in use but we can write the temporary file. Restart and copy it over the existing
onFileCallback->OnFile(&threadInfo->onFileStruct);
}
else
{
// Regular file in use but we can write the temporary file. Restart and copy it over the existing
rakFree_Ex(threadInfo->onFileStruct.fileData, _FILE_AND_LINE_ );
threadInfo->onFileStruct.fileData=threadInfo->postPatchFile;
onFileCallback->OnFile(&threadInfo->onFileStruct);
threadInfo->onFileStruct.fileData=0;
}
}
break;
case PC_ERROR_FILE_WRITE_FAILURE:
{
if (threadInfo->onFileStruct.context.op==PC_WRITE_FILE)
{
onFileCallback->OnFile(&threadInfo->onFileStruct);
}
else
{
rakFree_Ex(threadInfo->onFileStruct.fileData, _FILE_AND_LINE_ );
threadInfo->onFileStruct.fileData=threadInfo->postPatchFile;
threadInfo->onFileStruct.byteLengthOfThisFile=threadInfo->postPatchLength;
onFileCallback->OnFile(&threadInfo->onFileStruct);
threadInfo->onFileStruct.fileData=0;
}
}
break;
case PC_ERROR_PATCH_TARGET_MISSING:
{
onFileCallback->OnFile(&threadInfo->onFileStruct);
client->Redownload(threadInfo->onFileStruct.fileName);
}
break;
case PC_ERROR_PATCH_APPLICATION_FAILURE:
{
// Failure - signal class and download this file.
onFileCallback->OnFile(&threadInfo->onFileStruct);
client->Redownload(threadInfo->onFileStruct.fileName);
}
break;
case PC_ERROR_PATCH_RESULT_CHECKSUM_FAILURE:
{
// Failure - signal class and download this file.
onFileCallback->OnFile(&threadInfo->onFileStruct);
client->Redownload(threadInfo->onFileStruct.fileName);
}
break;
default:
{
if (threadInfo->onFileStruct.context.op==PC_WRITE_FILE)
{
onFileCallback->OnFile(&threadInfo->onFileStruct);
}
else
{
rakFree_Ex(threadInfo->onFileStruct.fileData, _FILE_AND_LINE_ );
threadInfo->onFileStruct.fileData=threadInfo->postPatchFile;
onFileCallback->OnFile(&threadInfo->onFileStruct);
threadInfo->onFileStruct.fileData=0;
}
}
break;
}
if (threadInfo->prePatchFile)
rakFree_Ex(threadInfo->prePatchFile, _FILE_AND_LINE_ );
if (threadInfo->postPatchFile)
rakFree_Ex(threadInfo->postPatchFile, _FILE_AND_LINE_ );
if (threadInfo->onFileStruct.fileData)
rakFree_Ex(threadInfo->onFileStruct.fileData, _FILE_AND_LINE_ );
RakNet::OP_DELETE(threadInfo, _FILE_AND_LINE_);
}
// If both input and output are empty, we are done.
if (onFileCallback->Update()==false)
canDeleteUser=true;
if ( downloadComplete &&
canDeleteUser &&
threadPool.IsWorking()==false)
{
// Stop threads before calling OnThreadCompletion, in case the other thread starts a new instance of this thread.
StopThreads();
client->OnThreadCompletion();
//.........这里部分代码省略.........