From 254187c03cc10332a183aee718bea033f6493873 Mon Sep 17 00:00:00 2001 From: Michael Van Canneyt Date: Thu, 20 Mar 2025 14:56:42 +0100 Subject: [PATCH] * Started message --- packages/wasi/src/rtl.webthreads.pas | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/packages/wasi/src/rtl.webthreads.pas b/packages/wasi/src/rtl.webthreads.pas index bccbd8a..5614d00 100644 --- a/packages/wasi/src/rtl.webthreads.pas +++ b/packages/wasi/src/rtl.webthreads.pas @@ -43,6 +43,7 @@ Const cmdLoaded = 'loaded'; cmdKill = 'kill'; cmdSpawn = 'spawn'; + cmdStarted = 'started'; cmdLoad = 'load'; cmdRun = 'run'; cmdExecute = 'execute'; @@ -195,6 +196,7 @@ Type Module : TJSWebAssemblyModule; end; + { TWorkerLoadCommandHelper } TWorkerLoadCommandHelper = class helper for TWorkerLoadCommand @@ -202,6 +204,17 @@ Type Class function Create(aModule : TJSWebAssemblyModule; aMemory : TJSWebAssemblyMemory): TWorkerLoadCommand; static;reintroduce; end; + TWorkerStartedCommand = class external name 'Object' (TWorkerCommand) + StartFunction : string; + end; + + { TWorkerStartedCommandHelper } + + TWorkerStartedCommandHelper = class helper for TWorkerStartedCommand + Class function CommandName : string; static; + Class function Create(aFunction : string): TWorkerStartedCommand; static;reintroduce; + end; + // Sent by main to worker: run thread procedure TWorkerRunCommand = class external name 'Object' (TWorkerCommand) @@ -386,6 +399,19 @@ begin Result.Module:=aModule; end; +{ TWorkerStartedCommandHelper } + +class function TWorkerStartedCommandHelper.CommandName: string; +begin + result:=cmdStarted; +end; + +class function TWorkerStartedCommandHelper.Create(aFunction: string): TWorkerStartedCommand; +begin + Result:=TWorkerStartedCommand(TWorkerCommand.NewWorker(CommandName)); + Result.StartFunction:=aFunction; +end; + { TWorkerSpawnThreadCommandHelper } class function TWorkerSpawnThreadCommandHelper.CommandName: string;