mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 17:59:22 +02:00
IDE: added flag to avoid multithreading - useful for debugging
git-svn-id: trunk@35372 -
This commit is contained in:
parent
badc3e74ca
commit
a4211c814f
@ -74,6 +74,25 @@ type
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
procedure ApplyFPCSrcFiles(FPCSrcDir: string; var Files: TStringList);
|
||||||
|
var
|
||||||
|
SrcCache: TFPCSourceCache;
|
||||||
|
begin
|
||||||
|
debugln(['ApplyFPCSrcFiles ',FPCSrcDir,' FileCount=',Files.Count]);
|
||||||
|
// copy Files to codetools cache
|
||||||
|
if CodeToolBoss<>nil then
|
||||||
|
begin
|
||||||
|
SrcCache:=CodeToolBoss.FPCDefinesCache.SourceCaches.Find(FPCSrcDir,true);
|
||||||
|
debugln(['ApplyFPCSrcFiles SrcCache.Update ...']);
|
||||||
|
SrcCache.Update(Files);
|
||||||
|
|
||||||
|
debugln(['ApplyFPCSrcFiles BuildBoss.RescanCompilerDefines ...']);
|
||||||
|
if BuildBoss<>nil then
|
||||||
|
BuildBoss.RescanCompilerDefines(false,false,false,true);
|
||||||
|
end;
|
||||||
|
FreeAndNil(Files);
|
||||||
|
end;
|
||||||
|
|
||||||
{ TFPCSrcScan }
|
{ TFPCSrcScan }
|
||||||
|
|
||||||
procedure TFPCSrcScan.Execute;
|
procedure TFPCSrcScan.Execute;
|
||||||
@ -95,23 +114,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFPCSrcScan.OnFilesGathered;
|
procedure TFPCSrcScan.OnFilesGathered;
|
||||||
var
|
|
||||||
SrcCache: TFPCSourceCache;
|
|
||||||
begin
|
begin
|
||||||
try
|
try
|
||||||
debugln(['TFPCSrcScan.OnFilesGathered ',Directory,' FileCount=',Files.Count]);
|
ApplyFPCSrcFiles(Directory,Files);
|
||||||
// copy Files to codetools cache
|
|
||||||
if CodeToolBoss<>nil then
|
|
||||||
begin
|
|
||||||
SrcCache:=CodeToolBoss.FPCDefinesCache.SourceCaches.Find(Directory,true);
|
|
||||||
debugln(['TFPCSrcScan.OnFilesGathered SrcCache.Update ...']);
|
|
||||||
SrcCache.Update(Files);
|
|
||||||
|
|
||||||
debugln(['TFPCSrcScan.OnFilesGathered BuildBoss.RescanCompilerDefines ...']);
|
|
||||||
if BuildBoss<>nil then
|
|
||||||
BuildBoss.RescanCompilerDefines(false,false,false,true);
|
|
||||||
end;
|
|
||||||
FreeAndNil(Files);
|
|
||||||
// delete item in progress window
|
// delete item in progress window
|
||||||
debugln(['TFPCSrcScan.OnFilesGathered closing progress item ...']);
|
debugln(['TFPCSrcScan.OnFilesGathered closing progress item ...']);
|
||||||
FreeAndNil(ProgressItem);
|
FreeAndNil(ProgressItem);
|
||||||
@ -206,30 +211,42 @@ end;
|
|||||||
|
|
||||||
procedure TFPCSrcScans.Scan(Directory: string);
|
procedure TFPCSrcScans.Scan(Directory: string);
|
||||||
var
|
var
|
||||||
|
{$IFDEF DisableMultiThreading}
|
||||||
|
Files: TStringList;
|
||||||
|
{$ELSE}
|
||||||
i: Integer;
|
i: Integer;
|
||||||
Item: TFPCSrcScan;
|
Item: TFPCSrcScan;
|
||||||
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
EnterCriticalsection;
|
{$IFDEF DisableMultiThreading}
|
||||||
try
|
// scan fpc source directory, check for terminated
|
||||||
// check if already scanning that directory
|
Files:=GatherFilesInFPCSources(Directory,nil);
|
||||||
for i:=0 to Count-1 do
|
if Files=nil then
|
||||||
if CompareFilenames(Directory,Items[i].Directory)=0 then exit;
|
Files:=TStringList.Create;
|
||||||
// create thread and create progress window
|
ApplyFPCSrcFiles(Directory,Files);
|
||||||
Item:=TFPCSrcScan.Create(true);
|
|
||||||
Item.FreeOnTerminate:=true;
|
|
||||||
Item.Scans:=Self;
|
|
||||||
Item.Directory:=Directory;
|
|
||||||
fItems.Add(Item);
|
|
||||||
finally
|
|
||||||
LeaveCriticalsection;
|
|
||||||
end;
|
|
||||||
Item.ProgressItem:=CreateProgressItem('FPCSrcScan',
|
|
||||||
Format(lisCreatingFileIndexOfFPCSources, [Directory]),
|
|
||||||
lisTheFileIndexIsNeededForFunctionsLikeFindDeclaratio);
|
|
||||||
{$IF defined(VER2_4_2) or defined(VER2_4_3)}
|
|
||||||
Item.Resume;
|
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
Item.Start;
|
EnterCriticalsection;
|
||||||
|
try
|
||||||
|
// check if already scanning that directory
|
||||||
|
for i:=0 to Count-1 do
|
||||||
|
if CompareFilenames(Directory,Items[i].Directory)=0 then exit;
|
||||||
|
// create thread and create progress window
|
||||||
|
Item:=TFPCSrcScan.Create(true);
|
||||||
|
Item.FreeOnTerminate:=true;
|
||||||
|
Item.Scans:=Self;
|
||||||
|
Item.Directory:=Directory;
|
||||||
|
fItems.Add(Item);
|
||||||
|
finally
|
||||||
|
LeaveCriticalsection;
|
||||||
|
end;
|
||||||
|
Item.ProgressItem:=CreateProgressItem('FPCSrcScan',
|
||||||
|
Format(lisCreatingFileIndexOfFPCSources, [Directory]),
|
||||||
|
lisTheFileIndexIsNeededForFunctionsLikeFindDeclaratio);
|
||||||
|
{$IF defined(VER2_4_2) or defined(VER2_4_3)}
|
||||||
|
Item.Resume;
|
||||||
|
{$ELSE}
|
||||||
|
Item.Start;
|
||||||
|
{$ENDIF}
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ program Lazarus;
|
|||||||
{off $DEFINE IDE_MEM_CHECK}
|
{off $DEFINE IDE_MEM_CHECK}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
{$IFDEF UNIX}
|
{$IF defined(UNIX) and not defined(DisableMultiThreading)}
|
||||||
cthreads,
|
cthreads,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{$IFDEF IDE_MEM_CHECK}
|
{$IFDEF IDE_MEM_CHECK}
|
||||||
|
Loading…
Reference in New Issue
Block a user