...Execute;
Var
startT:int64;//起始时间
endT:int64; //当前时间
Freq:int64; //
begin
QueryPerformanceCounter(startT);
QueryPerformanceFrequency(Freq);
while not Terminated do
begin
QueryPerformanceCounter(endT);
if (endT-startT)/Freq>=1 then //(endT-startT)/Freq得到的值的单位是Seconds
//为防止因线程阻塞等问题引起超时
//而不能预期重置记时器所以使用'>='
begin
//线程记时器代码
//
QueryPerformanceCounter(startT);//开始新一轮记时
end;
Sleep(10); //Sleep( milliseconds:Cardinal)的milliseconds最好大于0
end;
end;
写一个函数如procedure forlistview;
然后在线程的
procedure Route1.Execute;
begin
while not Terminated do //这里可以保证不停循环监控类似timer功能
begin
forlistview; // Synchronize(
end;
end;