refactor: destroy threads first

This commit is contained in:
Alex
2019-05-29 17:53:22 +02:00
parent b05d4cd413
commit fcf2d18a01
12 changed files with 64 additions and 55 deletions

View File

@ -5,8 +5,8 @@
#include "bar.hpp"
#include "client.hpp"
#include "modules/sway/ipc/client.hpp"
#include "util/sleeper_thread.hpp"
#include "util/json.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules::sway {
@ -20,10 +20,11 @@ class Mode : public ALabel, public sigc::trackable {
void onEvent(const struct Ipc::ipc_response&);
void worker();
waybar::util::SleeperThread thread_;
Ipc ipc_;
std::string mode_;
std::string mode_;
util::JsonParser parser_;
util::SleeperThread thread_;
Ipc ipc_;
};
} // namespace waybar::modules::sway

View File

@ -24,14 +24,15 @@ class Window : public ALabel, public sigc::trackable {
std::tuple<std::size_t, int, std::string, std::string> getFocusedNode(const Json::Value& nodes);
void getTree();
const Bar& bar_;
waybar::util::SleeperThread thread_;
Ipc ipc_;
std::mutex mutex_;
std::string window_;
int windowId_;
std::string app_id_;
util::JsonParser parser_;
const Bar& bar_;
std::mutex mutex_;
std::string window_;
int windowId_;
std::string app_id_;
util::JsonParser parser_;
util::SleeperThread thread_;
Ipc ipc_;
};
} // namespace waybar::modules::sway

View File

@ -36,13 +36,14 @@ class Workspaces : public IModule, public sigc::trackable {
const Json::Value& config_;
std::vector<Json::Value> workspaces_;
std::vector<std::string> workspaces_order_;
waybar::util::SleeperThread thread_;
Ipc ipc_;
std::mutex mutex_;
Gtk::Box box_;
util::JsonParser parser_;
bool scrolling_;
std::unordered_map<std::string, Gtk::Button> buttons_;
util::SleeperThread thread_;
Ipc ipc_;
};
} // namespace waybar::modules::sway