From 36581f3d3015d525db92248004e9dc7477705694 Mon Sep 17 00:00:00 2001 From: "Thiago Marcos P. Santos" Date: Mon, 31 Aug 2015 14:40:09 +0300 Subject: [core] Do not pass uv_loop_t around This should be abstracted by util::RunLoop --- include/mbgl/util/work_task.hpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 include/mbgl/util/work_task.hpp (limited to 'include/mbgl/util/work_task.hpp') diff --git a/include/mbgl/util/work_task.hpp b/include/mbgl/util/work_task.hpp new file mode 100644 index 0000000000..2224b211c4 --- /dev/null +++ b/include/mbgl/util/work_task.hpp @@ -0,0 +1,21 @@ +#ifndef MBGL_UTIL_WORK_TASK +#define MBGL_UTIL_WORK_TASK + +#include + +namespace mbgl { + +// A movable type-erasing function wrapper. This allows to store arbitrary invokable +// things (like std::function<>, or the result of a movable-only std::bind()) in the queue. +// Source: http://stackoverflow.com/a/29642072/331379 +class WorkTask : private util::noncopyable { +public: + virtual ~WorkTask() = default; + + virtual void operator()() = 0; + virtual void cancel() = 0; +}; + +} + +#endif -- cgit v1.2.1