std: implement `detach` for WASI-threads

When a thread is detached from the main thread, we automatically
cleanup any allocated memory. For this we first reset the stack-pointer
to the original stack-pointer of the main-thread so we can safely clear
the memory which also contains the thread's stack.
e06ab1b010Luuk de Gram committed on 6/26/2023, 6:00:58 PMparent622b7c4
2 files changedLine totals unavailable