Browse Source

Renamed Dispatcher::push to Dispatcher::post

merge-requests/365/head
eidheim 10 years ago
parent
commit
90b7f364c6
  1. 2
      README.md
  2. 2
      src/directories.cc
  3. 2
      src/dispatcher.cc
  4. 2
      src/dispatcher.h
  5. 4
      src/project.cc
  6. 12
      src/source_clang.cc
  7. 4
      src/terminal.cc

2
README.md

@ -1,5 +1,5 @@
# juCi++ # 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.
<!--<img src="https://github.com/cppit/jucipp/blob/master/docs/images/screenshot3.png"/>--> <!--<img src="https://github.com/cppit/jucipp/blob/master/docs/images/screenshot3.png"/>-->
## About ## About
Current IDEs struggle with C++ support due to the complexity of Current IDEs struggle with C++ support due to the complexity of

2
src/directories.cc

@ -98,7 +98,7 @@ Directories::Directories() : Gtk::TreeView(), stop_update_thread(false) {
it=last_write_times.erase(it); it=last_write_times.erase(it);
} }
if(update_paths.size()>0) { if(update_paths.size()>0) {
dispatcher.push([this] { dispatcher.post([this] {
update_mutex.lock(); update_mutex.lock();
for(auto &path: update_paths) { for(auto &path: update_paths) {
if(last_write_times.count(path)>0) if(last_write_times.count(path)>0)

2
src/dispatcher.cc

@ -18,7 +18,7 @@ Dispatcher::~Dispatcher() {
functions_mutex.unlock(); functions_mutex.unlock();
} }
void Dispatcher::push(std::function<void()> &&function) { void Dispatcher::post(std::function<void()> &&function) {
functions_mutex.lock(); functions_mutex.lock();
functions.emplace_back(function); functions.emplace_back(function);
functions_mutex.unlock(); functions_mutex.unlock();

2
src/dispatcher.h

@ -13,7 +13,7 @@ private:
public: public:
Dispatcher(); Dispatcher();
~Dispatcher(); ~Dispatcher();
void push(std::function<void()> &&function); void post(std::function<void()> &&function);
void disconnect(); void disconnect();
}; };

4
src/project.cc

@ -265,11 +265,11 @@ void Project::Clang::debug_start() {
debugging=false; debugging=false;
Terminal::get().async_print(run_arguments+" returned: "+std::to_string(exit_status)+'\n'); Terminal::get().async_print(run_arguments+" returned: "+std::to_string(exit_status)+'\n');
}, [this](const std::string &status) { }, [this](const std::string &status) {
dispatcher.push([this, status] { dispatcher.post([this, status] {
debug_update_status(status); debug_update_status(status);
}); });
}, [this](const boost::filesystem::path &file_path, int line_nr, int line_index) { }, [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.first=file_path;
Project::debug_stop.second.first=line_nr; Project::debug_stop.second.first=line_nr;
Project::debug_stop.second.second=line_index; Project::debug_stop.second.second=line_index;

12
src/source_clang.cc

@ -107,7 +107,7 @@ void Source::ClangViewParse::parse_initialize() {
break; break;
auto expected=ParseProcessState::STARTING; auto expected=ParseProcessState::STARTING;
if(parse_process_state.compare_exchange_strong(expected, ParseProcessState::PREPROCESSING)) { if(parse_process_state.compare_exchange_strong(expected, ParseProcessState::PREPROCESSING)) {
dispatcher.push([this] { dispatcher.post([this] {
auto expected=ParseProcessState::PREPROCESSING; auto expected=ParseProcessState::PREPROCESSING;
if(parse_mutex.try_lock()) { if(parse_mutex.try_lock()) {
if(parse_process_state.compare_exchange_strong(expected, ParseProcessState::PROCESSING)) 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)) { if(parse_process_state.compare_exchange_strong(expected, ParseProcessState::POSTPROCESSING)) {
clang_tokens=clang_tu->get_tokens(0, parse_thread_buffer.bytes()-1); clang_tokens=clang_tu->get_tokens(0, parse_thread_buffer.bytes()-1);
parse_mutex.unlock(); parse_mutex.unlock();
dispatcher.push([this] { dispatcher.post([this] {
if(parse_mutex.try_lock()) { if(parse_mutex.try_lock()) {
auto expected=ParseProcessState::POSTPROCESSING; auto expected=ParseProcessState::POSTPROCESSING;
if(parse_process_state.compare_exchange_strong(expected, ParseProcessState::IDLE)) { if(parse_process_state.compare_exchange_strong(expected, ParseProcessState::IDLE)) {
@ -145,7 +145,7 @@ void Source::ClangViewParse::parse_initialize() {
else { else {
parse_state=ParseState::STOP; parse_state=ParseState::STOP;
parse_mutex.unlock(); parse_mutex.unlock();
dispatcher.push([this] { dispatcher.post([this] {
Terminal::get().print("Error: failed to reparse "+this->file_path.string()+".\n", true); Terminal::get().print("Error: failed to reparse "+this->file_path.string()+".\n", true);
set_status(""); set_status("");
set_info(""); set_info("");
@ -652,7 +652,7 @@ void Source::ClangViewAutocomplete::autocomplete() {
auto autocomplete_data=std::make_shared<std::vector<AutoCompleteData> >(autocomplete_get_suggestions(buffer->raw(), line_nr, column_nr)); auto autocomplete_data=std::make_shared<std::vector<AutoCompleteData> >(autocomplete_get_suggestions(buffer->raw(), line_nr, column_nr));
if(parse_state==ParseState::PROCESSING) { if(parse_state==ParseState::PROCESSING) {
dispatcher.push([this, autocomplete_data] { dispatcher.post([this, autocomplete_data] {
if(autocomplete_state==AutocompleteState::CANCELED) { if(autocomplete_state==AutocompleteState::CANCELED) {
set_status(""); set_status("");
soft_reparse(); soft_reparse();
@ -698,7 +698,7 @@ void Source::ClangViewAutocomplete::autocomplete() {
}); });
} }
else { else {
dispatcher.push([this] { dispatcher.post([this] {
Terminal::get().print("Error: autocomplete failed, reparsing "+this->file_path.string()+"\n", true); Terminal::get().print("Error: autocomplete failed, reparsing "+this->file_path.string()+"\n", true);
autocomplete_state=AutocompleteState::CANCELED; autocomplete_state=AutocompleteState::CANCELED;
full_reparse(); full_reparse();
@ -778,7 +778,7 @@ bool Source::ClangViewAutocomplete::full_reparse() {
parse_thread.join(); parse_thread.join();
if(autocomplete_thread.joinable()) if(autocomplete_thread.joinable())
autocomplete_thread.join(); autocomplete_thread.join();
dispatcher.push([this] { dispatcher.post([this] {
parse_initialize(); parse_initialize();
full_reparse_running=false; full_reparse_running=false;
}); });

4
src/terminal.cc

@ -210,13 +210,13 @@ std::shared_ptr<Terminal::InProgress> Terminal::print_in_progress(std::string st
} }
void Terminal::async_print(const std::string &message, bool bold) { 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); Terminal::get().print(message, bold);
}); });
} }
void Terminal::async_print(size_t line_nr, const std::string &message) { 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<deleted_lines) if(line_nr<deleted_lines)
return; return;

Loading…
Cancel
Save