mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 06:22:30 +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
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
procedure EnterCriticalSection; // always use before access, when using Tool and View: always lock Tool before View
|
||||
procedure LeaveCriticalSection;
|
||||
// always use before access, when using Tool and View: always lock Tool before View
|
||||
procedure EnterCriticalSection; virtual;
|
||||
procedure LeaveCriticalSection; virtual;
|
||||
property Thread: TThread read FThread write FThread;
|
||||
procedure ConsistencyCheck; virtual;
|
||||
procedure AutoFree; // (only main thread) free if not in use
|
||||
@ -1225,14 +1226,12 @@ end;
|
||||
|
||||
procedure TAbstractExternalTool.EnterCriticalSection;
|
||||
begin
|
||||
Sleep(1); // Force context switch to prevent occational crash. Issue #36318, #37883 etc.
|
||||
FWorkerMessages.EnterCriticalSection;
|
||||
end;
|
||||
|
||||
procedure TAbstractExternalTool.LeaveCriticalSection;
|
||||
begin
|
||||
Assert(Assigned(FWorkerMessages), 'TAbstractExternalTool.LeaveCriticalSection: FWorkerMessages=Nil.');
|
||||
Sleep(1);
|
||||
FWorkerMessages.LeaveCriticalSection;
|
||||
end;
|
||||
|
||||
@ -2355,8 +2354,8 @@ var
|
||||
begin
|
||||
if csDestroying in ComponentState then exit;
|
||||
Changed:=false;
|
||||
EnterCriticalSection; // Beware: Tool is already in critical section
|
||||
try
|
||||
//EnterCriticalSection; // Beware: Tool is already in critical section !!!
|
||||
//try
|
||||
if (FPendingLines=nil) or (FPendingProgressLine=nil) then exit;
|
||||
//DebugLn(['TExtToolView.ProcessNewMessages START From=',FirstMsgLine,' To=',Tool.WorkerMessages.Count-1]);
|
||||
NewProgressLine:=nil;
|
||||
@ -2384,9 +2383,9 @@ begin
|
||||
PendingProgressLine.Msg:='';
|
||||
end;
|
||||
//debugln(['TExtToolView.ProcessNewMessages END Changed=',Changed,' Progress="',ProgressLine.Msg,'"']);
|
||||
finally
|
||||
LeaveCriticalSection;
|
||||
end;
|
||||
//finally !!!
|
||||
// LeaveCriticalSection;
|
||||
//end;
|
||||
|
||||
if Changed and Assigned(OnChanged) then begin
|
||||
// wake up main thread
|
||||
|
@ -55,6 +55,8 @@ type
|
||||
public
|
||||
constructor Create(aOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
procedure EnterCriticalSection; override;
|
||||
procedure LeaveCriticalSection; override;
|
||||
end;
|
||||
|
||||
{ TExternalToolsConsole }
|
||||
@ -193,6 +195,19 @@ begin
|
||||
inherited Destroy;
|
||||
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;
|
||||
// in console mode all output goes unparsed to console
|
||||
var
|
||||
|
Loading…
Reference in New Issue
Block a user