# std: implement \`detach\` for WASI-threads · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/e06ab1b0107e8a6a1720703a6df0f61f535b5e5a)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: e06ab1b0107e8a6a1720703a6df0f61f535b5e5a

Requested commit: e06ab1b0107e8a6a1720703a6df0f61f535b5e5a

Commit: e06ab1b0107e8a6a1720703a6df0f61f535b5e5a

Tree: 822263fe88040667a7482175c703f7e40dad8e86

Author: Luuk de Gram

Committer: Luuk de Gram

## Message

```
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.

```

## Parents

- [622b7c47468bc4508f4cfe840e0f8c51b54949dd](https://git.cafe/gitcafe/zig/commit/622b7c47468bc4508f4cfe840e0f8c51b54949dd?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/e06ab1b0107e8a6a1720703a6df0f61f535b5e5a?format=markdown)
