[libc-commits] [PATCH] D148290: Support custom attributes in pthread_create

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon May 22 10:24:31 PDT 2023


sivachandra added inline comments.


================
Comment at: libc/src/__support/threads/linux/thread.cpp:493
+  // TODO: We may have deallocated the stack. Can we reference local variables
+  // that may have spilled?
   if (style == ThreadStyle::POSIX)
----------------
goldstein.w.n wrote:
> sivachandra wrote:
> > This is a good catch! What do you think of just exiting with a return code of say -1 if the thread is detached? We can take this up separately.
> Won't that be a massive memory leak?
> 
> Although its not super clear how to handle this w.o some degree of inline-assembly.
> 
What I mean is, just add

```
    __llvm_libc::syscall_impl(SYS_exit, -1);
```

after line 489 but before the end of the scope.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148290



More information about the libc-commits mailing list