Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
17
Добавлен:
02.05.2014
Размер:
1.01 Кб
Скачать
unit mythrd;

interface

uses
Classes,Graphics,Windows,SysUtils,StdCtrls,syncobjs;

type
tmythread = class(TThread)
private
{ Private declarations }
counter:tedit;
count:integer;
protected
procedure Execute; override;
public
constructor Create(lb:tedit);
end;

implementation
uses unit1;

{ Important: Methods and properties of objects in VCL or CLX can only be used
in a method called using Synchronize, for example,

Synchronize(UpdateCaption);

and UpdateCaption could look like,

procedure tmythread.UpdateCaption;
begin
Form1.Caption := 'Updated in a thread';
end; }

{ tmythread }

constructor tmythread.Create(lb:tedit);
begin
counter:=lb;
count:=1;
inherited create(true);
end;

procedure tmythread.Execute;
begin
{ Place thread code here }
repeat
count:=count+1;
with Critical do begin
enter;
counter.Text:=inttostr(count);
leave;
end;
until count=1000;
end;

end.
Соседние файлы в папке prior4
  • #
    02.05.20141.8 Кб17mythrd.dcu
  • #
    02.05.20141.01 Кб17mythrd.pas
  • #
    02.05.20141.01 Кб17mythrd.~pas
  • #
    02.05.2014386 б17Proj.cfg
  • #
    02.05.20141.1 Кб17Proj.dof
  • #
    02.05.2014211 б17Proj.dpr
  • #
    02.05.2014876 б17Proj.res