mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-05 04:18:31 +02:00
* Correctly set current thread
This commit is contained in:
parent
3bf5c67485
commit
1a21ea41b8
@ -399,12 +399,14 @@ procedure WasiAllocateThreadVars; forward;
|
||||
{$push}{$S-} // no stack checking for this procedure
|
||||
procedure FPCWasmThreadStartPascal(tid: longint; start_arg: PWasmThread);
|
||||
begin
|
||||
{$IFDEF DEBUGWASMTHREADS}DebugWriteln('FPCWasmThreadStartPascal(...)');{$ENDIF}
|
||||
{$IFDEF DEBUGWASMTHREADS}DebugWriteln('FPCWasmThreadStartPascal('+IntToStr(tid)+','+IntToStr(ptrint(start_arg))+')');{$ENDIF}
|
||||
|
||||
start_arg^.ID:=tid;
|
||||
GlobalCurrentThread:=@start_arg;
|
||||
GlobalCurrentThread:=start_arg;
|
||||
GlobalIsMainThread:=0;
|
||||
GlobalIsWorkerThread:=1;
|
||||
{$IFDEF DEBUGWASMTHREADS}DebugWriteln('Check : TID='+IntToStr(tid)+', start_arg_id='+IntToStr(start_arg^.ID)+', currentthread= '+IntTostr(ptrint(GetCurrentThreadID))+')');{$ENDIF}
|
||||
|
||||
{$IFDEF FPC_WASM_WORKER_THREADS_CAN_WAIT}
|
||||
GlobalIsThreadBlockable:=1;
|
||||
{$ELSE FPC_WASM_WORKER_THREADS_CAN_WAIT}
|
||||
@ -610,6 +612,7 @@ begin
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
|
||||
function WasiGetCurrentThreadId : TThreadID;
|
||||
begin
|
||||
Result:=GetSelfThread;
|
||||
|
Loading…
Reference in New Issue
Block a user