* Fix compiler warnings/hints

This commit is contained in:
Michael Van Canneyt 2025-01-23 11:35:23 +01:00
parent a162e116d6
commit 4095882662

View File

@ -8,9 +8,9 @@ interface
uses uses
{$IFDEF FPC_DOTTEDUNITS} {$IFDEF FPC_DOTTEDUNITS}
JSApi.JS, System.Classes, System.SysUtils, System.WebThreads, Wasi.Env, BrowserApi.WebOrWorker; JSApi.JS, System.SysUtils, System.WebThreads, Wasi.Env, BrowserApi.WebOrWorker;
{$ELSE} {$ELSE}
JS, Classes, SysUtils, Rtl.WebThreads, wasienv, weborworker; JS, SysUtils, Rtl.WebThreads, wasienv, weborworker;
{$ENDIF} {$ENDIF}
@ -130,9 +130,6 @@ implementation
Resourcestring Resourcestring
SErrMaxWorkersReached = 'Cannot create thread worker, Maximum number of workers (%d) reached.'; SErrMaxWorkersReached = 'Cannot create thread worker, Maximum number of workers (%d) reached.';
var
Self_ : TWindowOrWorkerGlobalScope; external name 'self';
{ TWasmThread } { TWasmThread }
@ -343,11 +340,13 @@ end;
function TThreadController.thread_detach(thread_id: longint): Integer; function TThreadController.thread_detach(thread_id: longint): Integer;
begin begin
if thread_id=-1 then;
Result:=-1; Result:=-1;
end; end;
function TThreadController.thread_cancel(thread_id: longint): Integer; function TThreadController.thread_cancel(thread_id: longint): Integer;
begin begin
if thread_id=-1 then;
Result:=-1; Result:=-1;
end; end;
@ -388,36 +387,10 @@ function TThreadController.SpawnThread(aInfo: TThreadInfo): Integer;
Var Var
WT : TWasmThread; WT : TWasmThread;
lInterval : NativeInt;
TryCount : Integer;
Procedure TryRunCommand;
var
E : Exception;
begin
Writeln('TryRunCommand called');
if WT.Loaded then
begin
self_.clearInterval(lInterval);
SendRunCommand(WT);
end
else
begin
inc(TryCount);
if TryCount>20 then
begin
self_.clearInterval(lInterval);
RunTimeOut(aInfo,100*TryCount);
end;
end;
end;
begin begin
// Writeln('Enter TThreadController.SpawnThread for ID ',aInfo.ThreadID); // Writeln('Enter TThreadController.SpawnThread for ID ',aInfo.ThreadID);
TryCount:=0;
WT:=GetNewWorker; WT:=GetNewWorker;
if WT=nil then if WT=nil then
begin begin
@ -468,12 +441,14 @@ end;
procedure TThreadController.HandleKillCommand(aWorker : TWasmThread; aCommand: TWorkerKillCommand); procedure TThreadController.HandleKillCommand(aWorker : TWasmThread; aCommand: TWorkerKillCommand);
begin begin
if (aWorker<>Nil) and (aCommand<>Nil) then ;
// todo // todo
end; end;
procedure TThreadController.HandleCancelCommand(aWorker : TWasmThread; aCommand: TWorkerCancelCommand); procedure TThreadController.HandleCancelCommand(aWorker : TWasmThread; aCommand: TWorkerCancelCommand);
begin begin
if (aWorker<>Nil) and (aCommand<>Nil) then ;
// todo // todo
end; end;
@ -486,6 +461,7 @@ begin
if aWorker.ThreadID>0 then if aWorker.ThreadID>0 then
SendRunCommand(aWorker); SendRunCommand(aWorker);
// Writeln('Host: exiting TThreadController.HandleLoadedCommand'); // Writeln('Host: exiting TThreadController.HandleLoadedCommand');
if (aCommand<>Nil) then ;
end; end;
procedure TThreadController.HandleCleanupCommand(aWorker : TWasmThread; aCommand: TWorkerCleanupCommand); procedure TThreadController.HandleCleanupCommand(aWorker : TWasmThread; aCommand: TWorkerCleanupCommand);
@ -501,6 +477,7 @@ begin
Idx:=TJSarray(FIdleWorkers).indexOf(aWorker); Idx:=TJSarray(FIdleWorkers).indexOf(aWorker);
if Idx=-1 then if Idx=-1 then
FIdleWorkers:=Concat(FIdleWorkers,[aWorker]); FIdleWorkers:=Concat(FIdleWorkers,[aWorker]);
if (aCommand<>Nil) then ;
end; end;
procedure TThreadController.HandleConsoleCommand(aWorker : TWasmThread; aCommand: TWorkerConsoleCommand); procedure TThreadController.HandleConsoleCommand(aWorker : TWasmThread; aCommand: TWorkerConsoleCommand);