[Lldb-commits] [PATCH] D30702: Fix remaining threading issues in Log.h

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 7 10:06:08 PST 2017


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, so
I avoided locking primitives and used atomic variables instead. I have
also removed the (unused) setters for the mask and flags to make sure
that the only way to set them is through the enable/disable channel
functions.

I also add tests, which when run under tsan, verify that the use cases
like "doing an LLDB_LOGV while another thread disables logging" are
data-race-free.


https://reviews.llvm.org/D30702

Files:
  include/lldb/Utility/Log.h
  source/Utility/Log.cpp
  unittests/Utility/LogTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30702.90875.patch
Type: text/x-patch
Size: 11589 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20170307/2a441a0f/attachment-0001.bin>


More information about the lldb-commits mailing list