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

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

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

Visibility: public

Requested revision: f8cef32f27355e952ab27086886e68d5b8431515

Requested commit: f8cef32f27355e952ab27086886e68d5b8431515

Commit: f8cef32f27355e952ab27086886e68d5b8431515

Tree: bb183d82cfc0e88c11789c1b4a04648e8056b8ee

Author: LemonBoy

Committer: LemonBoy

## 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

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

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