本文整理汇总了C++中ThreadInfo::function方法的典型用法代码示例。如果您正苦于以下问题:C++ ThreadInfo::function方法的具体用法?C++ ThreadInfo::function怎么用?C++ ThreadInfo::function使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ThreadInfo
的用法示例。
在下文中一共展示了ThreadInfo::function方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateCountdown
DWORD WINAPI UpdateCountdown(LPVOID _lpParamter)
{
ThreadInfo* Info = (ThreadInfo*)_lpParamter;
LARGE_INTEGER pcFreq, currentTick;
if(!QueryPerformanceFrequency(&pcFreq))
{
//Todo: Insert Error Code
}
if(!QueryPerformanceCounter(¤tTick))
{
//Todo: Insert Error Code
}
double startTime = double(currentTick.QuadPart) / double(pcFreq.QuadPart);
//convert to milliseconds
double countdown = Info->time / 1000.0;
double lastTime = 0;
//loop forever
// or until the time is 0 or below 0
while(true)
{
QueryPerformanceCounter(¤tTick);
double currTime = (double(currentTick.QuadPart) / double(pcFreq.QuadPart)) - startTime;
countdown -= (currTime - lastTime);
lastTime = currTime;
//Are we ready to break?
if(countdown <= 0.0)
break;
}
//Call the function
Info->function();
//Delete the memory we allocated
delete Info;
return 0;
}