diff --git a/CMakeLists.txt b/CMakeLists.txt index 79a836f..07fff5a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required (VERSION 3.7) project (expandurl-mastodon - VERSION 0.2.6 + VERSION 0.3.0 LANGUAGES CXX ) diff --git a/src/masto.cpp b/src/masto.cpp index 84df9c6..600f577 100644 --- a/src/masto.cpp +++ b/src/masto.cpp @@ -17,6 +17,7 @@ #include #include // getenv() #include +#include #include "version.hpp" #include "expandurl-mastodon.hpp" @@ -65,6 +66,10 @@ const void Listener::start() cout << "DEBUG: Connection lost.\n"; _running = false; }); + while (_ptr == nullptr) + { + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + } } const void Listener::stop() @@ -85,6 +90,7 @@ std::vector Listener::get_new_messages() std::vector v; static std::uint_fast8_t count_empty = 0; + std::lock_guard lock(_ptr->get_mutex()); if (!_stream.empty()) { const string buffer = _stream;