Wrapping boost threads in scoped_ptr
Boost.Thread deprecated the copy ctor for threads; this is a better approach.
This commit is contained in:
parent
9dfa2f4e11
commit
30d5a3b8a5
@ -101,8 +101,8 @@ ClangCompleter::~ClangCompleter() {
|
||||
sorting_threads_.interrupt_all();
|
||||
sorting_threads_.join_all();
|
||||
|
||||
clang_thread_.interrupt();
|
||||
clang_thread_.join();
|
||||
clang_thread_->interrupt();
|
||||
clang_thread_->join();
|
||||
}
|
||||
|
||||
|
||||
@ -449,8 +449,8 @@ void ClangCompleter::InitThreads() {
|
||||
boost::ref( *this ) ) );
|
||||
}
|
||||
|
||||
clang_thread_ = thread( &ClangCompleter::ClangThreadMain,
|
||||
boost::ref( *this ) );
|
||||
clang_thread_.reset( new thread( &ClangCompleter::ClangThreadMain,
|
||||
boost::ref( *this ) ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "ClangResultsCache.h"
|
||||
|
||||
#include <boost/utility.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/thread/future.hpp>
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
||||
@ -174,7 +175,7 @@ private:
|
||||
// access it. Only one thread at a time is allowed to access any single
|
||||
// translation unit. Currently we only use one thread to access clang and that
|
||||
// is the thread represented by clang_thread_.
|
||||
boost::thread clang_thread_;
|
||||
boost::scoped_ptr< boost::thread > clang_thread_;
|
||||
|
||||
boost::thread_group sorting_threads_;
|
||||
|
||||
|
@ -103,8 +103,8 @@ IdentifierCompleter::~IdentifierCompleter() {
|
||||
query_threads_.interrupt_all();
|
||||
query_threads_.join_all();
|
||||
|
||||
buffer_identifiers_thread_.interrupt();
|
||||
buffer_identifiers_thread_.join();
|
||||
buffer_identifiers_thread_->interrupt();
|
||||
buffer_identifiers_thread_->join();
|
||||
}
|
||||
|
||||
|
||||
@ -283,9 +283,9 @@ void IdentifierCompleter::InitThreads() {
|
||||
boost::ref( latest_query_task_ ) ) );
|
||||
}
|
||||
|
||||
buffer_identifiers_thread_ = boost::thread(
|
||||
BufferIdentifiersThreadMain,
|
||||
boost::ref( buffer_identifiers_task_stack_ ) );
|
||||
buffer_identifiers_thread_.reset(
|
||||
new boost::thread( BufferIdentifiersThreadMain,
|
||||
boost::ref( buffer_identifiers_task_stack_ ) ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <boost/utility.hpp>
|
||||
#include <boost/unordered_map.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
@ -125,7 +126,7 @@ private:
|
||||
|
||||
boost::thread_group query_threads_;
|
||||
|
||||
boost::thread buffer_identifiers_thread_;
|
||||
boost::scoped_ptr< boost::thread > buffer_identifiers_thread_;
|
||||
|
||||
mutable LatestQueryTask latest_query_task_;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user