diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-12-31 12:01:59 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2018-12-31 12:02:02 +0100 |
commit | fe4199dace73ee38262528f7ae88cbfba99120dd (patch) | |
tree | 154d3b6f09ee158d31a3dc29379bc906647629fc /include/Window.hpp | |
parent | 3a5f81426395f1468e6d88e98da984a3fc2c2e78 (diff) |
Make thread-safe
Diffstat (limited to 'include/Window.hpp')
-rw-r--r-- | include/Window.hpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/Window.hpp b/include/Window.hpp index 4355fb8..645b578 100644 --- a/include/Window.hpp +++ b/include/Window.hpp @@ -10,6 +10,7 @@ #include <mutex> #include <random> #include <vector> +#include <glibmm/dispatcher.h> namespace dchat { @@ -22,7 +23,9 @@ namespace dchat std::shared_ptr<Rooms> rooms; WindowNotification *windowNotification; private: + using DispatcherHandler = std::function<void()>; bool drawBackground(const Cairo::RefPtr<Cairo::Context> &cairo); + void dispatchFunction(DispatcherHandler func); private: class OverlayDrawable : public Gtk::Overlay { @@ -53,5 +56,9 @@ namespace dchat std::vector<Node> backgroundNodes; int prevTimeMillis; sigc::connection drawBackgroundConnection; + + Glib::Dispatcher dispatcher; + std::mutex dispatcherMutex; + std::vector<DispatcherHandler> dispatcherHandlers; }; }
\ No newline at end of file |