-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathuThread.pas
More file actions
56 lines (40 loc) · 1.07 KB
/
uThread.pas
File metadata and controls
56 lines (40 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
unit uThread;
interface
uses
Classes;
type
TDownloader = class(TThread)
private
{ Private declarations }
protected
procedure Execute; override;
end;
implementation
{
Important: Methods and properties of objects in visual components can only be
used in a method called using Synchronize, for example,
Synchronize(UpdateCaption);
and UpdateCaption could look like,
procedure TDownloader.UpdateCaption;
begin
Form1.Caption := 'Updated in a thread';
end;
or
Synchronize(
procedure
begin
Form1.Caption := 'Updated in thread via an anonymous method'
end
)
);
where an anonymous method is passed.
Similarly, the developer can call the Queue method with similar parameters as
above, instead passing another TThread class as the first parameter, putting
the calling thread in a queue with the other thread.
}
{ TDownloader }
procedure TDownloader.Execute;
begin
{ Place thread code here }
end;
end.