isolated threading functions

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@133 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
blikblum
2007-03-19 17:46:44 +00:00
parent 6a072baafc
commit fbcb3d0030
8 changed files with 29 additions and 25 deletions

View File

@ -36,3 +36,8 @@
{.$define EnableAccessible} {.$define EnableAccessible}
{$define UseExternalDragManager} {$define UseExternalDragManager}
{$define UseDelphiCompat} {$define UseDelphiCompat}
//under linux the performance is poor with threading enabled
{$ifdef Windows}
{$define EnableThreadSupport}
{$endif}

View File

@ -11730,8 +11730,9 @@ begin
{$ifdef UseLocalMemoryManager} {$ifdef UseLocalMemoryManager}
FNodeMemoryManager := TVTNodeMemoryManager.Create; FNodeMemoryManager := TVTNodeMemoryManager.Create;
{$endif UseLocalMemoryManager} {$endif UseLocalMemoryManager}
{$ifdef EnableThreadSupport}
AddThreadReference; AddThreadReference;
{$endif}
end; end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
@ -11740,7 +11741,9 @@ destructor TBaseVirtualTree.Destroy;
begin begin
Exclude(FOptions.FMiscOptions, toReadOnly); Exclude(FOptions.FMiscOptions, toReadOnly);
{$ifdef EnableThreadSupport}
ReleaseThreadReference(Self); ReleaseThreadReference(Self);
{$endif}
StopWheelPanning; StopWheelPanning;
CancelEditNode; CancelEditNode;
@ -13350,7 +13353,7 @@ var
begin begin
DoStateChange([tsStopValidation], [tsUseCache]); DoStateChange([tsStopValidation], [tsUseCache]);
{$ifdef EnableThreadSupport}
// Check the worker thread existance. It might already be gone (usually on destruction of the last tree). // Check the worker thread existance. It might already be gone (usually on destruction of the last tree).
if Assigned(WorkerThread) then if Assigned(WorkerThread) then
begin begin
@ -13377,6 +13380,7 @@ begin
else // Remove any pending validation. else // Remove any pending validation.
WorkerThread.RemoveTree(Self); WorkerThread.RemoveTree(Self);
end; end;
{$endif}
end; end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
@ -23800,12 +23804,14 @@ begin
InterruptValidation; InterruptValidation;
FStartIndex := 0; FStartIndex := 0;
{$ifdef EnableThreadSupport}
if tsValidationNeeded in FStates then if tsValidationNeeded in FStates then
begin begin
// Tell the thread this tree needs actually something to do. // Tell the thread this tree needs actually something to do.
WorkerThread.AddTree(Self); WorkerThread.AddTree(Self);
WorkEvent.SetEvent; WorkEvent.SetEvent;
end; end;
{$endif}
end; end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------

View File

@ -1,7 +1,7 @@
object MainForm: TMainForm object MainForm: TMainForm
Left = 353 Left = 437
Height = 481 Height = 481
Top = 172 Top = 278
Width = 425 Width = 425
HorzScrollBar.Page = 424 HorzScrollBar.Page = 424
VertScrollBar.Page = 480 VertScrollBar.Page = 480
@ -14,7 +14,7 @@ object MainForm: TMainForm
Left = 12 Left = 12
Height = 14 Height = 14
Top = 12 Top = 12
Width = 117 Width = 152
Caption = 'Last operation duration:' Caption = 'Last operation duration:'
Color = clNone Color = clNone
ParentColor = False ParentColor = False

View File

@ -1,15 +1,13 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TMainForm','FORMDATA',[ LazarusResources.Add('TMainForm','FORMDATA',[
'TPF0'#9'TMainForm'#8'MainForm'#4'Left'#3'a'#1#6'Height'#3#225#1#3'Top'#3#172 'TPF0'#9'TMainForm'#8'MainForm'#4'Left'#3#181#1#6'Height'#3#225#1#3'Top'#3#22
+#0#5'Width'#3#169#1#18'HorzScrollBar.Page'#3#168#1#18'VertScrollBar.Page'#3 +#1#5'Width'#3#169#1#18'HorzScrollBar.Page'#3#168#1#18'VertScrollBar.Page'#3
+#224#1#13'ActiveControl'#7#3'VST'#7'Caption'#6#28'Simple Virtual Treeview de' +#224#1#13'ActiveControl'#7#3'VST'#7'Caption'#6#28'Simple Virtual Treeview de'
+'mo'#11'Font.Height'#2#245#9'Font.Name'#6#13'MS Sans Serif'#8'OnCreate'#7#10 +'mo'#11'Font.Height'#2#245#9'Font.Name'#6#13'MS Sans Serif'#8'OnCreate'#7#10
+'FormCreate'#0#6'TLabel'#6'Label1'#4'Left'#2#12#6'Height'#2#14#3'Top'#2#12#5 +'FormCreate'#0#6'TLabel'#6'Label1'#4'Left'#2#12#6'Height'#2#14#3'Top'#2#12#5
+'Width'#2'u'#7'Caption'#6#24'Last operation duration:'#5'Color'#7#6'clNone' +'Width'#3#152#0#7'Caption'#6#24'Last operation duration:'#5'Color'#7#6'clNon'
+#11'ParentColor'#8#0#0#18'TVirtualStringTree'#3'VST'#4'Left'#2#8#6'Height'#3 +'e'#11'ParentColor'#8#0#0#18'TVirtualStringTree'#3'VST'#4'Left'#2#8#6'Height'
+'>'#1#3'Top'#2'$'#5'Width'#3#141#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRigh' +#3'>'#1#3'Top'#2'$'#5'Width'#3#141#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRi'
+'t'#8'akBottom'#0#11'BorderStyle'#7#8'bsSingle'#18'Colors.BorderColor'#7#12 +'ght'#8'akBottom'#0#11'BorderStyle'#7#8'bsSingle'#18'Colors.BorderColor'#7#12
+'clWindowText'#15'Colors.HotColor'#7#7'clBlack'#5'Ctl3D'#9#20'Header.AutoSiz' +'clWindowText'#15'Colors.HotColor'#7#7'clBlack'#5'Ctl3D'#9#20'Header.AutoSiz'
+'eIndex'#2#255#18'Header.Font.Height'#2#245#16'Header.Font.Name'#6#13'MS San' +'eIndex'#2#255#18'Header.Font.Height'#2#245#16'Header.Font.Name'#6#13'MS San'
+'s Serif'#17'Header.MainColumn'#2#255#14'Header.Options'#11#14'hoColumnResiz' +'s Serif'#17'Header.MainColumn'#2#255#14'Header.Options'#11#14'hoColumnResiz'

View File

@ -1,7 +1,7 @@
unit Main; unit Main;
{$MODE Delphi} {$MODE Delphi}
{$define DEBUG} {.$define DEBUG}
// Demonstration project for TVirtualStringTree to generally show how to get started. // Demonstration project for TVirtualStringTree to generally show how to get started.
// Written by Mike Lischke. // Written by Mike Lischke.

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<PathDelim Value="\"/> <PathDelim Value="/"/>
<Version Value="5"/> <Version Value="5"/>
<General> <General>
<Flags> <Flags>
@ -26,16 +26,13 @@
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local> </local>
</RunParams> </RunParams>
<RequiredPackages Count="3"> <RequiredPackages Count="2">
<Item1> <Item1>
<PackageName Value="virtualtreeview_package"/> <PackageName Value="virtualtreeview_package"/>
</Item1> </Item1>
<Item2> <Item2>
<PackageName Value="miscutils_package"/>
</Item2>
<Item3>
<PackageName Value="LCL"/> <PackageName Value="LCL"/>
</Item3> </Item2>
</RequiredPackages> </RequiredPackages>
<Units Count="4"> <Units Count="4">
<Unit0> <Unit0>
@ -59,7 +56,7 @@
<UnitName Value="Main"/> <UnitName Value="Main"/>
</Unit2> </Unit2>
<Unit3> <Unit3>
<Filename Value="..\..\units\gtk\mmsystem.pas"/> <Filename Value="../../units/gtk/mmsystem.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="mmsystem"/> <UnitName Value="mmsystem"/>
</Unit3> </Unit3>
@ -67,7 +64,6 @@
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>
<Version Value="5"/> <Version Value="5"/>
<PathDelim Value="\"/>
<CodeGeneration> <CodeGeneration>
<Generate Value="Faster"/> <Generate Value="Faster"/>
</CodeGeneration> </CodeGeneration>

View File

@ -8,7 +8,7 @@ uses
{$ENDIF}{$ENDIF} {$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset Interfaces, // this includes the LCL widgetset
Forms Forms
{ add your units here }, Main, miscutils_package, virtualtreeview_package, { add your units here }, Main, virtualtreeview_package,
mmsystem; mmsystem;
begin begin

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<PathDelim Value="\"/> <PathDelim Value="/"/>
<Version Value="5"/> <Version Value="5"/>
<General> <General>
<Flags> <Flags>
@ -65,7 +65,6 @@
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>
<Version Value="5"/> <Version Value="5"/>
<PathDelim Value="\"/>
<CodeGeneration> <CodeGeneration>
<Generate Value="Faster"/> <Generate Value="Faster"/>
</CodeGeneration> </CodeGeneration>