[PATCH] correct llvm::sys::Memory thread-safety

Reid Kleckner rnk at google.com
Mon Oct 14 10:46:03 PDT 2013


On Mon, Oct 14, 2013 at 10:35 AM, Jeffrey Yasskin <jyasskin at googlers.com>wrote:

> On Mon, Oct 14, 2013 at 9:49 AM, Reid Kleckner <rnk at google.com> wrote:
> > This seems like way overkill for something that doesn't have a real
> > finalizer.
>
> Are you worried about running extra code on shutdown? If so,
> ManagedStatic could check is_trivially_destructible in C++11 mode and
> avoid registering an atexit callback. +1 to Jim's preference to avoid
> doing anything custom if we can avoid it.


OK, Jeffrey the shared memory expert has spoken and recommends doing it
this way.  :)

ManagedStatic will register itself to be finalized at llvm_shutdown time.
 I just don't see any reason to get involved in that for a size_t.


> > All threads will observe the same page size, right?  Why not
> > query the size and do an atomic store if the size is uninitialized?
>  You'd
> > probably need to consult a shared memory expert to get this 100% correct.
> >
> >
> > On Mon, Oct 14, 2013 at 9:01 AM, Jim Kearney <jim.kearney at oracle.com>
> wrote:
> >>
> >> Please review the attached patch which is intended to fix
> >> http://llvm.org/bugs/show_bug.cgi?id=15749. If it's acceptable, please
> >> commit it.
> >>
> >> It replaces an auto static with a ManagedStatic<> to eliminate a race in
> >> multithreaded code generation (on some platforms/compilers).
> >>
> >> Thanks,
> >> J. Kearney
> >>
> >>
> >> _______________________________________________
> >> llvm-commits mailing list
> >> llvm-commits at cs.uiuc.edu
> >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> >>
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131014/9c7e3387/attachment.html>


More information about the llvm-commits mailing list