mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 17:19:23 +02:00
ExtTool: Use a hack Sleep(1) added in r64005 #ad65618c2b to Enter-/LeaveCriticalSection only for LazBuild. It caused bad slowdowns in the IDE.
git-svn-id: trunk@64212 -
This commit is contained in:
parent
1c9c36d205
commit
d5099bfbd4
@ -513,8 +513,9 @@ type
|
|||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure EnterCriticalSection; // always use before access, when using Tool and View: always lock Tool before View
|
// always use before access, when using Tool and View: always lock Tool before View
|
||||||
procedure LeaveCriticalSection;
|
procedure EnterCriticalSection; virtual;
|
||||||
|
procedure LeaveCriticalSection; virtual;
|
||||||
property Thread: TThread read FThread write FThread;
|
property Thread: TThread read FThread write FThread;
|
||||||
procedure ConsistencyCheck; virtual;
|
procedure ConsistencyCheck; virtual;
|
||||||
procedure AutoFree; // (only main thread) free if not in use
|
procedure AutoFree; // (only main thread) free if not in use
|
||||||
@ -1225,14 +1226,12 @@ end;
|
|||||||
|
|
||||||
procedure TAbstractExternalTool.EnterCriticalSection;
|
procedure TAbstractExternalTool.EnterCriticalSection;
|
||||||
begin
|
begin
|
||||||
Sleep(1); // Force context switch to prevent occational crash. Issue #36318, #37883 etc.
|
|
||||||
FWorkerMessages.EnterCriticalSection;
|
FWorkerMessages.EnterCriticalSection;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TAbstractExternalTool.LeaveCriticalSection;
|
procedure TAbstractExternalTool.LeaveCriticalSection;
|
||||||
begin
|
begin
|
||||||
Assert(Assigned(FWorkerMessages), 'TAbstractExternalTool.LeaveCriticalSection: FWorkerMessages=Nil.');
|
Assert(Assigned(FWorkerMessages), 'TAbstractExternalTool.LeaveCriticalSection: FWorkerMessages=Nil.');
|
||||||
Sleep(1);
|
|
||||||
FWorkerMessages.LeaveCriticalSection;
|
FWorkerMessages.LeaveCriticalSection;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2355,8 +2354,8 @@ var
|
|||||||
begin
|
begin
|
||||||
if csDestroying in ComponentState then exit;
|
if csDestroying in ComponentState then exit;
|
||||||
Changed:=false;
|
Changed:=false;
|
||||||
EnterCriticalSection; // Beware: Tool is already in critical section
|
//EnterCriticalSection; // Beware: Tool is already in critical section !!!
|
||||||
try
|
//try
|
||||||
if (FPendingLines=nil) or (FPendingProgressLine=nil) then exit;
|
if (FPendingLines=nil) or (FPendingProgressLine=nil) then exit;
|
||||||
//DebugLn(['TExtToolView.ProcessNewMessages START From=',FirstMsgLine,' To=',Tool.WorkerMessages.Count-1]);
|
//DebugLn(['TExtToolView.ProcessNewMessages START From=',FirstMsgLine,' To=',Tool.WorkerMessages.Count-1]);
|
||||||
NewProgressLine:=nil;
|
NewProgressLine:=nil;
|
||||||
@ -2384,9 +2383,9 @@ begin
|
|||||||
PendingProgressLine.Msg:='';
|
PendingProgressLine.Msg:='';
|
||||||
end;
|
end;
|
||||||
//debugln(['TExtToolView.ProcessNewMessages END Changed=',Changed,' Progress="',ProgressLine.Msg,'"']);
|
//debugln(['TExtToolView.ProcessNewMessages END Changed=',Changed,' Progress="',ProgressLine.Msg,'"']);
|
||||||
finally
|
//finally !!!
|
||||||
LeaveCriticalSection;
|
// LeaveCriticalSection;
|
||||||
end;
|
//end;
|
||||||
|
|
||||||
if Changed and Assigned(OnChanged) then begin
|
if Changed and Assigned(OnChanged) then begin
|
||||||
// wake up main thread
|
// wake up main thread
|
||||||
|
@ -55,6 +55,8 @@ type
|
|||||||
public
|
public
|
||||||
constructor Create(aOwner: TComponent); override;
|
constructor Create(aOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
procedure EnterCriticalSection; override;
|
||||||
|
procedure LeaveCriticalSection; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TExternalToolsConsole }
|
{ TExternalToolsConsole }
|
||||||
@ -193,6 +195,19 @@ begin
|
|||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TExternalToolConsole.EnterCriticalSection;
|
||||||
|
begin
|
||||||
|
// A hack to prevent occational crash in LazBuild. Issue #36318, #37883 etc.
|
||||||
|
Sleep(1); // ToDo: Find the real bug and fix it.
|
||||||
|
inherited EnterCriticalSection;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TExternalToolConsole.LeaveCriticalSection;
|
||||||
|
begin
|
||||||
|
Sleep(1);
|
||||||
|
inherited LeaveCriticalSection;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TExternalToolConsole.CreateView;
|
procedure TExternalToolConsole.CreateView;
|
||||||
// in console mode all output goes unparsed to console
|
// in console mode all output goes unparsed to console
|
||||||
var
|
var
|
||||||
|
Loading…
Reference in New Issue
Block a user