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

View File

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

View File

@ -1,15 +1,13 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TMainForm','FORMDATA',[
'TPF0'#9'TMainForm'#8'MainForm'#4'Left'#3'a'#1#6'Height'#3#225#1#3'Top'#3#172
+#0#5'Width'#3#169#1#18'HorzScrollBar.Page'#3#168#1#18'VertScrollBar.Page'#3
'TPF0'#9'TMainForm'#8'MainForm'#4'Left'#3#181#1#6'Height'#3#225#1#3'Top'#3#22
+#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'
+'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
+'Width'#2'u'#7'Caption'#6#24'Last operation duration:'#5'Color'#7#6'clNone'
+#11'ParentColor'#8#0#0#18'TVirtualStringTree'#3'VST'#4'Left'#2#8#6'Height'#3
+'>'#1#3'Top'#2'$'#5'Width'#3#141#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRigh'
+'t'#8'akBottom'#0#11'BorderStyle'#7#8'bsSingle'#18'Colors.BorderColor'#7#12
+'Width'#3#152#0#7'Caption'#6#24'Last operation duration:'#5'Color'#7#6'clNon'
+'e'#11'ParentColor'#8#0#0#18'TVirtualStringTree'#3'VST'#4'Left'#2#8#6'Height'
+#3'>'#1#3'Top'#2'$'#5'Width'#3#141#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRi'
+'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'
+'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'

View File

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

View File

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

View File

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

View File

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