帮我看一个程序,我写的一个微秒级延时子程序,需要多线程吗?
延时子程序如下:程序代码:
void DelayUs(__int64 Us) { LARGE_INTEGER CurrTicks, TicksCount; QueryPerformanceFrequency(&TicksCount); QueryPerformanceCounter(&CurrTicks); TicksCount.QuadPart = TicksCount.QuadPart * Us / 1000000; TicksCount.QuadPart += CurrTicks.QuadPart; while (CurrTicks.QuadPart < TicksCount.QuadPart) QueryPerformanceCounter(&CurrTicks); }
调用函数:
DelayUs( 7200);
能否实现延时7.2ms?
我调用延时函数是在一个线程函数里面,演示程序需要放在一个单独的线程函数里面吗?
新手求教?