# std: make the use of pthread_join POSIX-compliant · gitcafe/zig

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

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

Visibility: public

Requested revision: 7c13bec7cb545eb3d92f1edeb4af57f433a865c7

Requested commit: 7c13bec7cb545eb3d92f1edeb4af57f433a865c7

Commit: 7c13bec7cb545eb3d92f1edeb4af57f433a865c7

Tree: 59d5d6263c34745341a96503fb76ebc92f216ce7

Author: LemonBoy

Committer: Andrew Kelley

## Message

```
std: make the use of pthread_join POSIX-compliant

Applications supplying their own custom stack to pthread_create are not
allowed to free the allocated memory after pthread_join returns as,
according to the specification, the thread is not guaranteed to be dead
after the join call returns.

Avoid this class of problems by avoiding the use of a custom stack
altogether, let pthread handle its own resources.

Allocations made on the child stack are now done on the C heap.

Thanks @semarie for noticing the problem on OpenBSD and suggesting a
fix.

Closes #7275

```

## Parents

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

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