创建互斥对象和线程
var
hMutex: THandle;
constructor TSendTread.Create(Suspended: Boolean;
Name: String);
begin
hMutex := CreateMutex (nil, false, pChar(Name));
inherited Create(Suspended);
FreeOnTerminate:=True;
end;
执行线程
procedure TSendTread.Execute;
begin
while not Terminateddo
begin
try
Sleep(60000);
WaitForSingleObject (hMutex, INFINITE);
Synchronize (SendNote);
finally
ReleaseMutex(hMutex);
end;
end;
end;
SendNote是一个过程
定时向数据库添加数据