mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-06 05:10:52 +02:00
+ WebAssembly threads: introduced TWasmThread.ThreadHasFinished boolean
This commit is contained in:
parent
6dfd2de188
commit
492e38069c
@ -50,6 +50,7 @@ Type
|
||||
TWasmThread = Record
|
||||
InitialStackPointer : Pointer;
|
||||
InitTLSBase : Pointer;
|
||||
ThreadHasFinished : Boolean;
|
||||
ID : LongInt; // Allocated by host
|
||||
ThreadFunction : TThreadFunc;
|
||||
ThreadFunctionArg : Pointer;
|
||||
@ -446,6 +447,16 @@ asm
|
||||
local.get 0 ;; tid
|
||||
local.get 1 ;; start_arg
|
||||
call $FPCWasmThreadStartPascal
|
||||
|
||||
;; Set start_arg^.ThreadHasFinished to true.
|
||||
;; This is done from within inline asm, after the pascal code has finished
|
||||
;; executing, because it indicates that the thread no longer needs its TLS
|
||||
;; block and linear stack block, so this means it's safe to free them.
|
||||
local.get 1 ;; start_arg
|
||||
i32.const 8 ;; offset to ThreadHasFinished
|
||||
i32.add
|
||||
i32.const 1 ;; true
|
||||
i32.atomic.store8
|
||||
end;
|
||||
|
||||
exports wasi_thread_start;
|
||||
|
Loading…
Reference in New Issue
Block a user