listmonitor_threads.pas
来自「source code for the Marco Cantu s book D」· PAS 代码 · 共 43 行
PAS
43 行
unit ListMonitor_Threads;
interface
uses
Classes, StdCtrls, Forms, SysUtils, Windows;
type
TAddToListThread = class(TThread)
private
{ Private declarations }
protected
procedure Execute; override;
end;
implementation
procedure TAddToListThread.Execute;
var
aList: TListBox;
I: Integer;
begin
while not Terminated do
begin
aList := Application.MainForm.FindComponent (
'ListBox' + IntToStr (GetTickCount mod 3 + 1)) as TListBox;
System.TMonitor.Enter (aList);
try
aList.Items.Add(IntToStr (GetCurrentThreadID) + ' starting: ' + TimeToStr (Now));
for I := 1 to 30 do
if not Terminated then
Sleep (100)
else
Exit;
aList.Items.Add(IntToStr (GetCurrentThreadID) + ' stopping: ' + TimeToStr (Now));
finally
System.TMonitor.Exit (aList);
end;
end;
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?