diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2019-07-05 17:42:08 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2019-07-05 17:42:08 +0000 |
commit | f39c2e188d811ede3758eb98aa0201c1c8f978a1 (patch) | |
tree | e8642eccc48fd93d723b35a66bfb7178ba297777 /lldb/source/Core/Communication.cpp | |
parent | 6e6d229e5e95b00964656ae1a555bc843e37926d (diff) | |
download | bcm5719-llvm-f39c2e188d811ede3758eb98aa0201c1c8f978a1.tar.gz bcm5719-llvm-f39c2e188d811ede3758eb98aa0201c1c8f978a1.zip |
Change LaunchThread interface to return an expected.
Change the interface to return an expected, instead of taking a Status
pointer.
Differential revision: https://reviews.llvm.org/D64163
llvm-svn: 365226
Diffstat (limited to 'lldb/source/Core/Communication.cpp')
-rw-r--r-- | lldb/source/Core/Communication.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lldb/source/Core/Communication.cpp b/lldb/source/Core/Communication.cpp index c39976d6556..a67cb925d64 100644 --- a/lldb/source/Core/Communication.cpp +++ b/lldb/source/Core/Communication.cpp @@ -204,10 +204,23 @@ bool Communication::StartReadThread(Status *error_ptr) { m_read_thread_enabled = true; m_read_thread_did_exit = false; - m_read_thread = ThreadLauncher::LaunchThread( - thread_name, Communication::ReadThread, this, error_ptr); + auto maybe_thread = ThreadLauncher::LaunchThread( + thread_name, Communication::ReadThread, this); + if (maybe_thread) { + m_read_thread = *maybe_thread; + } else { + if (error_ptr) + *error_ptr = Status(maybe_thread.takeError()); + else { + LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST), + "failed to launch host thread: {}", + llvm::toString(maybe_thread.takeError())); + } + } + if (!m_read_thread.IsJoinable()) m_read_thread_enabled = false; + return m_read_thread_enabled; } |