1
0
mirror of https://github.com/loginov-dmitry/multithread.git synced 2024-11-24 16:53:48 +02:00

Ex11 converted to Lazarus

This commit is contained in:
loginov-dmitry 2024-10-13 19:06:47 +03:00
parent c050b512ae
commit ab80b7e79d
7 changed files with 174 additions and 4 deletions

2
.gitignore vendored
View File

@ -28,3 +28,5 @@ __history
/Ex9/lib
/Ex10/backup
/Ex10/lib
/Ex11/backup
/Ex11/lib

BIN
Ex11/Ex11ProjLaz.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

85
Ex11/Ex11ProjLaz.lpi Normal file
View File

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="12"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
<Title Value="Ex11ProjLaz"/>
<Scaled Value="True"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<XPManifest>
<DpiAware Value="True"/>
</XPManifest>
<Icon Value="0"/>
</General>
<BuildModes>
<Item Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<UseFileFilters Value="True"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
</RunParams>
<RequiredPackages>
<Item>
<PackageName Value="LCL"/>
</Item>
</RequiredPackages>
<Units>
<Unit>
<Filename Value="Ex11ProjLaz.lpr"/>
<IsPartOfProject Value="True"/>
</Unit>
<Unit>
<Filename Value="Ex11Unit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
</Unit>
<Unit>
<Filename Value="..\CommonUtils\MTUtils.pas"/>
<IsPartOfProject Value="True"/>
</Unit>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="Ex11ProjLaz"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="..\CommonUtils"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf3"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
<Debugging>
<Exceptions>
<Item>
<Name Value="EAbort"/>
</Item>
<Item>
<Name Value="ECodetoolError"/>
</Item>
<Item>
<Name Value="EFOpenError"/>
</Item>
</Exceptions>
</Debugging>
</CONFIG>

24
Ex11/Ex11ProjLaz.lpr Normal file
View File

@ -0,0 +1,24 @@
program Ex11ProjLaz;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
{$IFDEF HASAMIGA}
athreads,
{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, Ex11Unit, MTUtils;
{$R *.res}
begin
RequireDerivedFormResource:=True;
Application.Scaled:=True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

BIN
Ex11/Ex11ProjLaz.res Normal file

Binary file not shown.

49
Ex11/Ex11Unit.lfm Normal file
View File

@ -0,0 +1,49 @@
object Form1: TForm1
Left = 0
Height = 390
Top = 0
Width = 775
Caption = 'Form1'
ClientHeight = 390
ClientWidth = 775
Color = clBtnFace
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Tahoma'
OnCreate = FormCreate
OnDestroy = FormDestroy
Position = poScreenCenter
object btnRunInParallelThread: TButton
Left = 8
Height = 33
Top = 8
Width = 217
Caption = 'Запустить доп. поток'
TabOrder = 0
OnClick = btnRunInParallelThreadClick
end
object Button1: TButton
Left = 248
Height = 33
Top = 8
Width = 177
Caption = 'Остановить потоки'
TabOrder = 1
OnClick = Button1Click
end
object ListBox1: TListBox
Left = 8
Height = 326
Top = 56
Width = 759
Anchors = [akTop, akLeft, akRight, akBottom]
ItemHeight = 0
TabOrder = 2
end
object Timer1: TTimer
Interval = 100
OnTimer = Timer1Timer
Left = 416
Top = 72
end
end

View File

@ -1,10 +1,16 @@
unit Ex11Unit;
{$IFDEF FPC}{$CODEPAGE UTF8}{$H+}{$MODE DELPHI}{$ENDIF}
unit Ex11Unit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, MTUtils, ComCtrls, ExtCtrls, StrUtils, Contnrs;
{$IFnDEF FPC}
Windows, Messages,
{$ELSE}
LCLIntf, LCLType, LMessages,
{$ENDIF}
SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, MTUtils, ComCtrls,
ExtCtrls, StrUtils, Contnrs;
type
TLogMessage = class
@ -45,7 +51,11 @@ var
EventList: TThreadList;
implementation
{$R *.dfm}
{$IFnDEF FPC}
{$R *.dfm}
{$ELSE}
{$R *.lfm}
{$ENDIF}
procedure TForm1.btnRunInParallelThreadClick(Sender: TObject);
begin