aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Utility/Log.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Utility/Log.cpp')
-rw-r--r--lldb/source/Utility/Log.cpp16
1 files changed, 2 insertions, 14 deletions
diff --git a/lldb/source/Utility/Log.cpp b/lldb/source/Utility/Log.cpp
index ff654ec93e78..d229538073d1 100644
--- a/lldb/source/Utility/Log.cpp
+++ b/lldb/source/Utility/Log.cpp
@@ -30,7 +30,6 @@
#include <process.h>
#else
#include <unistd.h>
-#include <pthread.h>
#endif
using namespace lldb_private;
@@ -89,7 +88,7 @@ void Log::Enable(const std::shared_ptr<llvm::raw_ostream> &stream_sp,
uint32_t options, uint32_t flags) {
llvm::sys::ScopedWriter lock(m_mutex);
- uint32_t mask = m_mask.fetch_or(flags, std::memory_order_relaxed);
+ MaskType mask = m_mask.fetch_or(flags, std::memory_order_relaxed);
if (mask | flags) {
m_options.store(options, std::memory_order_relaxed);
m_stream_sp = stream_sp;
@@ -100,7 +99,7 @@ void Log::Enable(const std::shared_ptr<llvm::raw_ostream> &stream_sp,
void Log::Disable(uint32_t flags) {
llvm::sys::ScopedWriter lock(m_mutex);
- uint32_t mask = m_mask.fetch_and(~flags, std::memory_order_relaxed);
+ MaskType mask = m_mask.fetch_and(~flags, std::memory_order_relaxed);
if (!(mask & ~flags)) {
m_stream_sp.reset();
m_channel.log_ptr.store(nullptr, std::memory_order_relaxed);
@@ -180,9 +179,6 @@ void Log::Warning(const char *format, ...) {
}
void Log::Initialize() {
-#ifdef LLVM_ON_UNIX
- pthread_atfork(nullptr, nullptr, &Log::DisableLoggingChild);
-#endif
InitializeLldbChannel();
}
@@ -346,11 +342,3 @@ void Log::Format(llvm::StringRef file, llvm::StringRef function,
message << payload << "\n";
WriteMessage(message.str());
}
-
-void Log::DisableLoggingChild() {
- // Disable logging by clearing out the atomic variable after forking -- if we
- // forked while another thread held the channel mutex, we would deadlock when
- // trying to write to the log.
- for (auto &c: *g_channel_map)
- c.second.m_channel.log_ptr.store(nullptr, std::memory_order_relaxed);
-}