Fixing thread segfault issues with new Boost 1.53
The answer was to use boost::move() on the functors, but since there is AFAIK no move emulation support for Boost.Function, the fix may only work on C++11 compilers. That needs to be looked into.
This commit is contained in:
parent
f42c6a5d98
commit
9dfa2f4e11
@ -77,15 +77,6 @@ endif()
|
||||
|
||||
#############################################################################
|
||||
|
||||
# Due to a bug/misconfiguration/stupidity, boost 1.52 and libc++ don't like each
|
||||
# other much: a compilation error "Constexpr function never produces a constant
|
||||
# expression" pops up when trying to compile anything that uses
|
||||
# boost/chrono/duration.hpp (namely boost/thread for us). This is a workaround
|
||||
# that prevents this from happening. Also present in cpp/ycm/CMakeLists.txt.
|
||||
# See here for more details: https://svn.boost.org/trac/boost/ticket/7671
|
||||
# TODO: remove this when it's fixed upstream (probably boost 1.53).
|
||||
#add_definitions( -DBOOST_THREAD_DONT_USE_CHRONO )
|
||||
|
||||
if( MSVC )
|
||||
# BOOST_PYTHON_SOURCE makes boost use the correct __declspec and
|
||||
# BOOST_ALL_NO_LIB turns off MSVC library autolinking
|
||||
|
@ -199,7 +199,8 @@ Future< void > ClangCompleter::UpdateTranslationUnitAsync(
|
||||
shared_ptr< ClangPackagedTask > clang_packaged_task =
|
||||
make_shared< ClangPackagedTask >();
|
||||
|
||||
clang_packaged_task->parsing_task_ = packaged_task< void >( functor );
|
||||
clang_packaged_task->parsing_task_ = packaged_task< void >(
|
||||
boost::move( functor ) );
|
||||
unique_future< void > future =
|
||||
clang_packaged_task->parsing_task_.get_future();
|
||||
clang_task_.Set( clang_packaged_task );
|
||||
@ -341,7 +342,7 @@ void ClangCompleter::CreateClangTask(
|
||||
clang_packaged_task->completions_task_ =
|
||||
packaged_task< AsyncCompletions >(
|
||||
bind( ReturnValueAsShared< std::vector< CompletionData > >,
|
||||
candidates_for_location_functor ) );
|
||||
boost::move( candidates_for_location_functor ) ) );
|
||||
|
||||
clang_task_.Set( clang_packaged_task );
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ void IdentifierCompleter::AddCandidatesToDatabaseFromBufferAsync(
|
||||
boost::move( filepath ) );
|
||||
|
||||
buffer_identifiers_task_stack_.Push(
|
||||
make_shared< packaged_task< void > >( functor ) );
|
||||
make_shared< packaged_task< void > >( boost::move( functor ) ) );
|
||||
}
|
||||
|
||||
|
||||
@ -202,7 +202,7 @@ Future< AsyncResults > IdentifierCompleter::CandidatesForQueryAndTypeAsync(
|
||||
|
||||
QueryTask task = make_shared< packaged_task< AsyncResults > >(
|
||||
bind( ReturnValueAsShared< std::vector< std::string > >,
|
||||
functor ) );
|
||||
boost::move( functor ) ) );
|
||||
|
||||
unique_future< AsyncResults > future = task->get_future();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user