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

Noah Goldstein via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon May 22 12:44:37 PDT 2023


goldstein.w.n 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:
> > 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.
> Ahh, makes sense. I'll create follow up for that.
Made `0`, is I think its all the same and we have some tests that `pthread_exit` returns success. But see: D151142


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