1
0
mirror of https://github.com/loginov-dmitry/multithread.git synced 2025-02-16 09:21:46 +02:00

Ex12 converted to Lazarus (required trunk FPC)

This commit is contained in:
loginov-dmitry 2024-10-13 21:47:00 +03:00
parent ab80b7e79d
commit dd8ae118a1
7 changed files with 184 additions and 5 deletions

2
.gitignore vendored
View File

@ -30,3 +30,5 @@ __history
/Ex10/lib
/Ex11/backup
/Ex11/lib
/Ex12/backup
/Ex12/lib

BIN
Ex12/Ex12ProjLaz.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

85
Ex12/Ex12ProjLaz.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="Ex12ProjLaz"/>
<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="Ex12ProjLaz.lpr"/>
<IsPartOfProject Value="True"/>
</Unit>
<Unit>
<Filename Value="Ex12Unit.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="Ex12ProjLaz"/>
</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
Ex12/Ex12ProjLaz.lpr Normal file
View File

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

BIN
Ex12/Ex12ProjLaz.res Normal file

Binary file not shown.

59
Ex12/Ex12Unit.lfm Normal file
View File

@ -0,0 +1,59 @@
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 labLabLastThreadTime: TLabel
Left = 8
Height = 16
Top = 47
Width = 336
Caption = 'Информация о времени последнего запущенного потока'
end
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 = 313
Top = 69
Width = 759
Anchors = [akTop, akLeft, akRight, akBottom]
ItemHeight = 0
TabOrder = 2
end
object btnClearListBox: TButton
Left = 431
Height = 33
Top = 8
Width = 75
Caption = 'Очистить'
TabOrder = 3
OnClick = btnClearListBoxClick
end
end

View File

@ -1,11 +1,16 @@
unit Ex12Unit;
{$IFDEF FPC}{$CODEPAGE UTF8}{$H+}{$MODE DELPHI}{$ENDIF}
unit Ex12Unit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, MTUtils, ComCtrls, ExtCtrls, StrUtils, Contnrs,
Generics.Collections;
{$IFnDEF FPC}
Windows, Messages,
{$ELSE}
LCLIntf, LCLType, LMessages,
{$ENDIF}
SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, MTUtils, ComCtrls,
ExtCtrls, StrUtils, Contnrs, Generics.Collections;
type
TMyThread = class(TThread)
@ -37,7 +42,11 @@ var
Form1: TForm1;
implementation
{$R *.dfm}
{$IFnDEF FPC}
{$R *.dfm}
{$ELSE}
{$R *.lfm}
{$ENDIF}
procedure TForm1.btnClearListBoxClick(Sender: TObject);
begin