diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/CurlTask.h | 15 | ||||
-rw-r--r-- | includes/LuaTask.h | 3 | ||||
-rw-r--r-- | includes/TaskMan.h | 9 | ||||
-rw-r--r-- | includes/c++11-surrogates.h | 21 |
4 files changed, 23 insertions, 25 deletions
diff --git a/includes/CurlTask.h b/includes/CurlTask.h new file mode 100644 index 0000000..f9ac492 --- /dev/null +++ b/includes/CurlTask.h @@ -0,0 +1,15 @@ +#pragma once + +#include <curl/curl.h> +#include <Task.h> +#include <TaskMan.h> + +namespace Balau { + +class CurlTask : public Task { + friend class TaskMan; + protected: + CURL * m_curlHandle; +}; + +}; diff --git a/includes/LuaTask.h b/includes/LuaTask.h index a12f89f..e3dfe1c 100644 --- a/includes/LuaTask.h +++ b/includes/LuaTask.h @@ -1,6 +1,5 @@ #pragma once -#include <c++11-surrogates.h> #include <BLua.h> #include <Task.h> #include <StacklessTask.h> @@ -58,7 +57,7 @@ class LuaTask : public Task { ~LuaTask() { L.weaken(); } virtual const char * getName() const { return "LuaTask"; } private: - LuaTask(Lua && __L, LuaExecCell * cell) : L(Move(__L)), m_cell(cell) { if (!cell->needsStack()) setStackless(); } + LuaTask(Lua && __L, LuaExecCell * cell) : L(std::move(__L)), m_cell(cell) { if (!cell->needsStack()) setStackless(); } virtual void Do(); Lua L; LuaExecCell * m_cell; diff --git a/includes/TaskMan.h b/includes/TaskMan.h index a9eb490..a51653b 100644 --- a/includes/TaskMan.h +++ b/includes/TaskMan.h @@ -103,10 +103,15 @@ class TaskMan { int m_stopCode = 0; bool m_stopped = false; bool m_allowedToSignal = false; + ev::timer m_curlTimer; CURLM * m_curlMulti = false; int m_curlStillRunning = 0; - static int curlSocketCallback(CURL * easy, curl_socket_t s, int what, void * userp, void * socketp); - static int curlMultiTimerCallback(CURLM * multi, long timeout_ms, void * userp); + static int curlSocketCallbackStatic(CURL * easy, curl_socket_t s, int what, void * userp, void * socketp); + int curlSocketCallback(CURL * easy, curl_socket_t s, int what, void * socketp); + void curlSocketEventCallback(ev::io & w, int revents); + static int curlMultiTimerCallbackStatic(CURLM * multi, long timeout_ms, void * userp); + int curlMultiTimerCallback(CURLM * multi, long timeout_ms); + void curlMultiTimerEventCallback(ev::timer & w, int revents); TaskMan(const TaskMan &) = delete; TaskMan & operator=(const TaskMan &) = delete; diff --git a/includes/c++11-surrogates.h b/includes/c++11-surrogates.h deleted file mode 100644 index 4f3a1a0..0000000 --- a/includes/c++11-surrogates.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -namespace Balau { - -template <typename T> struct RemoveReference { - typedef T type; -}; - -template <typename T> struct RemoveReference<T&> { - typedef T type; -}; - -template <typename T> struct RemoveReference<T&&> { - typedef T type; -}; - -template <typename T> typename RemoveReference<T>::type&& Move(T&& t) { - return static_cast<typename RemoveReference<T>::type&&>(t); -} - -}; |