tidwall / neco

Concurrency library for C (coroutines)
MIT License
1.1k stars 79 forks source link

fix the possibility for pthread_detach(0) #2

Closed j4cobgarby closed 4 months ago

j4cobgarby commented 4 months ago

Please do not open a pull request without first filing an issue and/or discussing the feature directly with me.

Please ensure you adhere to every item in this list

Describe your changes

When detaching a thread, there is a certain case where that pthread_t variable could be 0. On my system, pthread_detach(0) is causing a segfault, crashing the program. On other systems (and according to the man page), it shouldn't segfault but instead gracefully return an error code, however in that case it is still an error, and I believe it should be fixed in this way, in any case.

Issue number and link

1