[PATCH] D108850: [LLD] Remove global state in lldCommon

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 24 10:14:45 PDT 2021


aganea added a comment.

Ping.



================
Comment at: lld/Common/ErrorHandler.cpp:109
     lld::outs().flush();
     lld::errs().flush();
   }
----------------
aganea wrote:
> mehdi_amini wrote:
> > I'm curious about this change: you're protecting what seems to be global methods with a non-global mutex. The code comment for the mutex says ```
> >   // The functions defined in this file can be called from multiple threads,
> >   // but lld::outs() or lld::errs() are not thread-safe. We protect them using a
> >   // mutex.
> > ```
> > 
> > This made sense when the mutex was global, less so now. Can you clarify this? (and update the comment)
> Before, the mutex and the functions were global. They both have the same lifetime as the call to `lldMain()`. I was planning on supporting several concurrent calls to `lldMain()` in the future. Updated the comment.
I meant //now//, they both have the same lifetime as the call to `lldMain()`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108850



More information about the llvm-commits mailing list