在Delphi中使用线程

在Delphi中使用线程

在Delphi中使用线程很容易。

同步可以很好地使用:-)

功能

uses System.Classes, System.SysUtils, Vcl.Forms;

procedure Wait(Proc: TProc);
var
  Thread: TThread;
begin
  Thread := TThread.CreateAnonymousThread(procedure()
  begin
    Proc;
  end);
  Thread.FreeOnTerminate := True;
  Thread.Start;
  while not Thread.Finished do Application.ProcessMessages;
end;

如何使用

等待(Procedure()
 开始
   // .... 细节
 结尾);

guest
0 Comments
Inline Feedbacks
View all comments