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

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

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

Visibility: public

Requested revision: 834609038c83e0122b506fadfa38b9acb7ee9068

Requested commit: 834609038c83e0122b506fadfa38b9acb7ee9068

Commit: 834609038c83e0122b506fadfa38b9acb7ee9068

Tree: b738876952e39d484ddb642a28ce4763c4771098

Author: Luuk de Gram

Committer: Luuk de Gram

## Message

```
std: implement `join` for WASI-threads

We now reset the Thread ID to 0 and wake up the main thread listening
for the thread to finish. We use inline assembly as we cannot use
the stack to set the thread ID as it could possibly clobber any
of the memory.

Currently, we leak the memory that was allocated for the thread.
We need to implement a way where we can clean up the memory without
using the stack (as the stack is stored inside this same memory).

```

## Parents

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

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