diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2020-10-05 21:37:07 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2020-10-05 21:37:07 -0400 |
commit | 0cdaea97dd035bcbf9d46b8a261b3eeaf4dea69c (patch) | |
tree | c340566dbccc77d2d3cb21b1290e01e5c1c0d9c4 /discord/http.hpp | |
parent | cfcb0d4e662b960dcdd331a7c61dc2b9c614f930 (diff) | |
download | abaddon-portaudio-0cdaea97dd035bcbf9d46b8a261b3eeaf4dea69c.tar.gz abaddon-portaudio-0cdaea97dd035bcbf9d46b8a261b3eeaf4dea69c.zip |
slap a bunch of shit everywhere until the crashing stops
Diffstat (limited to 'discord/http.hpp')
-rw-r--r-- | discord/http.hpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/discord/http.hpp b/discord/http.hpp index b8489f9..12667f7 100644 --- a/discord/http.hpp +++ b/discord/http.hpp @@ -5,14 +5,9 @@ #include <string> #include <unordered_map> #include <memory> - -template<typename F> -void fire_and_forget(F &&func) { - auto ptr = std::make_shared<std::future<void>>(); - *ptr = std::async(std::launch::async, [ptr, func]() { - func(); - }); -} +#include <mutex> +#include <queue> +#include <glibmm.h> class HTTPClient { public: @@ -28,6 +23,11 @@ private: void OnResponse(cpr::Response r, std::function<void(cpr::Response r)> cb); void CleanupFutures(); + mutable std::mutex m_mutex; + Glib::Dispatcher m_dispatcher; + std::queue<std::function<void()>> m_queue; + void RunCallbacks(); + std::vector<std::future<void>> m_futures; std::string m_api_base; std::string m_authorization; |