[libc-commits] [PATCH] D148294: [LIBC] Handle multiple calls to `detach` more gracefully

Noah Goldstein via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Apr 13 23:06:15 PDT 2023


goldstein.w.n added inline comments.


================
Comment at: libc/src/__support/threads/linux/thread.cpp:355
-
-  cleanup_thread_resources(attrib);
-
----------------
sivachandra wrote:
> A joinable but exiting thread will not cleanup its resources if we remove this. What problem is your patch trying to address?
Hmm? AFAICT this is only the handle for `pthread_detach ()`, how does it affect the cleanup routine? Its just handling the UB case of multiple calls to `pthread_detach ()` without almost certainty causing an infinite loop.

If thread is joinable then `Thread::join()` does cleanup.
If thread is not joinable then `thread_exist()` does cleanup.




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148294/new/

https://reviews.llvm.org/D148294



More information about the libc-commits mailing list