[delphi] 비동기 함수

2018-03-28

비동기 함수

비동기로 지연된 코드 실행을 위해 작성

proc: 프로시저

nInterval: 지연 시간

1
2
3
4
5
6
7
8
9
10
11
12
13
procedure SetTimeOut(proc: TProc; nInterval: Integer = 100);
begin
TThread.CreateAnonymousThread( procedure
begin
Sleep(nInterval);
// 내부 코드
TThread.Synchronize( TThread.CurrentThread, procedure
begin
// GUI 코드
proc
end);
end).Start;
end;