瀏覽代碼

* Threadhost property for easy access to thread host class

Michael Van Canneyt 5 月之前
父節點
當前提交
a4ffb0957d
共有 1 個文件被更改,包括 8 次插入0 次删除
  1. 8 0
      packages/wasi/src/wasiworkerthreadhost.pas

+ 8 - 0
packages/wasi/src/wasiworkerthreadhost.pas

@@ -190,6 +190,7 @@ Type
   TWorkerThreadControllerApplication = class(TWorkerWASIHostApplication)
   Private
     FThreadSupport : TThreadController;
+    function GetThreadHost: TWASIThreadControllerHost;
   Protected
     function CreateThreadSupport(aEnv: TPas2JSWASIEnvironment): TThreadController; virtual;
     procedure HandleConsoleWrite(Sender: TObject; aOutput: string); virtual;
@@ -201,6 +202,8 @@ Type
   Public
     procedure ShowException(aError: Exception); override;
     property ThreadSupport : TThreadController Read FThreadSupport;
+    property ThreadHost : TWASIThreadControllerHost read GetThreadHost;
+
   end;
 
 function GetJSClassName(aObj : TJSObject) : string;
@@ -875,6 +878,11 @@ begin
     end;
 end;
 
+function TWorkerThreadControllerApplication.GetThreadHost: TWASIThreadControllerHost;
+begin
+  Result:=(Host as  TWASIThreadControllerHost)
+end;
+
 function TWorkerThreadControllerApplication.CreateThreadSupport(aEnv : TPas2JSWASIEnvironment) : TThreadController;
 
 begin