This revision was automatically updated to reflect the committed changes.
Closed by commit rL297368: Fix remaining threading issues in Log.h (authored by
labath).
Changed prior to commit:
https://reviews.llvm.org/D30702?vs=90994&id=91147#toc
Repository:
rL LLVM
https://reviews.llvm.org/D307
labath added a comment.
Comment at: source/Utility/Log.cpp:82
+ if (mask | flags) {
+m_options.store(options, std::memory_order_release);
+m_stream_sp = stream_sp;
zturner wrote:
> Might as well use `memory_order_relaxed` here.
Done. I missed that one
zturner accepted this revision.
zturner added inline comments.
Comment at: source/Utility/Log.cpp:82
+ if (mask | flags) {
+m_options.store(options, std::memory_order_release);
+m_stream_sp = stream_sp;
Might as well use `memory_order_relaxed` here.
==
labath updated this revision to Diff 90994.
labath added a comment.
I've repurposed the stream mutex to protect the entirety of enable/disable
operations. To make this flow better, I've also gotten rid of the LogAndChannel
struct and make Channel a member of Log directly (which required moving som
labath added a comment.
Comment at: include/lldb/Utility/Log.h:152
- Flags &GetOptions();
+ const Flags GetOptions() const;
eugene wrote:
> Seems like const on return value is not really needed.
Well... otherwise people could write something like:
`log.
zturner added inline comments.
Comment at: source/Utility/Log.cpp:90-91
uint32_t options, uint32_t flags) {
- log.GetMask().Set(flags);
- if (log.GetMask().Get()) {
-log.GetOptions().Reset(options);
+ uint32_t mask = log.m_mask.load(std::memory_o
eugene added inline comments.
Comment at: include/lldb/Utility/Log.h:152
- Flags &GetOptions();
+ const Flags GetOptions() const;
Seems like const on return value is not really needed.
Comment at: include/lldb/Utility/Log.h:163
+ std::at
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.
With my limited std::atomic experience, this seems fine.
https://reviews.llvm.org/D30702
___
lldb-commits mailing list
lldb-commits@lists.llv
labath created this revision.
This fixes two threading issues in the logging code. The access to the
mask and options flags had data races when we were trying to
enable/disable logging while another thread was writing to the log.
Since we can log from almost any context, and we want it to be fast,