diff --git a/README.md b/README.md index 61d1c58..e1148a8 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # juCi++ -###### a lightweight platform independent C++-IDE with support for C++11, C++14, and experimental C++17 features depending on libclang version. +###### a lightweight, platform independent C++-IDE with support for C++11, C++14, and experimental C++17 features depending on libclang version. ## About Current IDEs struggle with C++ support due to the complexity of diff --git a/src/directories.cc b/src/directories.cc index be1d779..aa1a3c7 100644 --- a/src/directories.cc +++ b/src/directories.cc @@ -98,7 +98,7 @@ Directories::Directories() : Gtk::TreeView(), stop_update_thread(false) { it=last_write_times.erase(it); } if(update_paths.size()>0) { - dispatcher.push([this] { + dispatcher.post([this] { update_mutex.lock(); for(auto &path: update_paths) { if(last_write_times.count(path)>0) diff --git a/src/dispatcher.cc b/src/dispatcher.cc index bc862f2..e5cc42d 100644 --- a/src/dispatcher.cc +++ b/src/dispatcher.cc @@ -18,7 +18,7 @@ Dispatcher::~Dispatcher() { functions_mutex.unlock(); } -void Dispatcher::push(std::function &&function) { +void Dispatcher::post(std::function &&function) { functions_mutex.lock(); functions.emplace_back(function); functions_mutex.unlock(); diff --git a/src/dispatcher.h b/src/dispatcher.h index 5a326e4..502c330 100644 --- a/src/dispatcher.h +++ b/src/dispatcher.h @@ -13,7 +13,7 @@ private: public: Dispatcher(); ~Dispatcher(); - void push(std::function &&function); + void post(std::function &&function); void disconnect(); }; diff --git a/src/project.cc b/src/project.cc index 0fc11b4..774411e 100644 --- a/src/project.cc +++ b/src/project.cc @@ -265,11 +265,11 @@ void Project::Clang::debug_start() { debugging=false; Terminal::get().async_print(run_arguments+" returned: "+std::to_string(exit_status)+'\n'); }, [this](const std::string &status) { - dispatcher.push([this, status] { + dispatcher.post([this, status] { debug_update_status(status); }); }, [this](const boost::filesystem::path &file_path, int line_nr, int line_index) { - dispatcher.push([this, file_path, line_nr, line_index] { + dispatcher.post([this, file_path, line_nr, line_index] { Project::debug_stop.first=file_path; Project::debug_stop.second.first=line_nr; Project::debug_stop.second.second=line_index; diff --git a/src/source_clang.cc b/src/source_clang.cc index 439f192..52800d3 100644 --- a/src/source_clang.cc +++ b/src/source_clang.cc @@ -107,7 +107,7 @@ void Source::ClangViewParse::parse_initialize() { break; auto expected=ParseProcessState::STARTING; if(parse_process_state.compare_exchange_strong(expected, ParseProcessState::PREPROCESSING)) { - dispatcher.push([this] { + dispatcher.post([this] { auto expected=ParseProcessState::PREPROCESSING; if(parse_mutex.try_lock()) { if(parse_process_state.compare_exchange_strong(expected, ParseProcessState::PROCESSING)) @@ -126,7 +126,7 @@ void Source::ClangViewParse::parse_initialize() { if(parse_process_state.compare_exchange_strong(expected, ParseProcessState::POSTPROCESSING)) { clang_tokens=clang_tu->get_tokens(0, parse_thread_buffer.bytes()-1); parse_mutex.unlock(); - dispatcher.push([this] { + dispatcher.post([this] { if(parse_mutex.try_lock()) { auto expected=ParseProcessState::POSTPROCESSING; if(parse_process_state.compare_exchange_strong(expected, ParseProcessState::IDLE)) { @@ -145,7 +145,7 @@ void Source::ClangViewParse::parse_initialize() { else { parse_state=ParseState::STOP; parse_mutex.unlock(); - dispatcher.push([this] { + dispatcher.post([this] { Terminal::get().print("Error: failed to reparse "+this->file_path.string()+".\n", true); set_status(""); set_info(""); @@ -652,7 +652,7 @@ void Source::ClangViewAutocomplete::autocomplete() { auto autocomplete_data=std::make_shared >(autocomplete_get_suggestions(buffer->raw(), line_nr, column_nr)); if(parse_state==ParseState::PROCESSING) { - dispatcher.push([this, autocomplete_data] { + dispatcher.post([this, autocomplete_data] { if(autocomplete_state==AutocompleteState::CANCELED) { set_status(""); soft_reparse(); @@ -698,7 +698,7 @@ void Source::ClangViewAutocomplete::autocomplete() { }); } else { - dispatcher.push([this] { + dispatcher.post([this] { Terminal::get().print("Error: autocomplete failed, reparsing "+this->file_path.string()+"\n", true); autocomplete_state=AutocompleteState::CANCELED; full_reparse(); @@ -778,7 +778,7 @@ bool Source::ClangViewAutocomplete::full_reparse() { parse_thread.join(); if(autocomplete_thread.joinable()) autocomplete_thread.join(); - dispatcher.push([this] { + dispatcher.post([this] { parse_initialize(); full_reparse_running=false; }); diff --git a/src/terminal.cc b/src/terminal.cc index cbd8739..9681ab8 100644 --- a/src/terminal.cc +++ b/src/terminal.cc @@ -210,13 +210,13 @@ std::shared_ptr Terminal::print_in_progress(std::string st } void Terminal::async_print(const std::string &message, bool bold) { - dispatcher.push([this, message, bold] { + dispatcher.post([this, message, bold] { Terminal::get().print(message, bold); }); } void Terminal::async_print(size_t line_nr, const std::string &message) { - dispatcher.push([this, line_nr, message] { + dispatcher.post([this, line_nr, message] { if(line_nr