Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
21
Добавлен:
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.
Соседние файлы в папке prob4_1
  • #
    02.05.20141.8 Кб20mythrd.dcu
  • #
    02.05.20141.01 Кб21mythrd.pas
  • #
    02.05.20141.01 Кб20mythrd.~pas
  • #
    02.05.2014386 б21Proj.cfg
  • #
    02.05.20141.1 Кб20Proj.dof
  • #
    02.05.2014211 б20Proj.dpr
  • #
    02.05.2014876 б20Proj.res