0
0
Fork 0
mirror of https://github.com/boltgolt/howdy.git synced 2024-09-12 09:41:18 +02:00

fix: fix issues in optional_task

This commit is contained in:
MusiKid 2022-01-26 14:11:55 +01:00 committed by musikid
parent 6cddf402b7
commit 30760be328
No known key found for this signature in database
GPG key ID: 7567D43648C6E2F4

View file

@ -20,7 +20,6 @@ public:
template <typename R, typename P>
auto wait(std::chrono::duration<R, P> dur) -> std::future_status;
auto get() -> T;
auto is_active() -> bool;
void stop(bool force);
~optional_task();
};
@ -28,7 +27,7 @@ public:
template <typename T>
optional_task<T>::optional_task(std::function<T()> fn)
: _task(std::packaged_task<T()>(std::move(fn))),
_future(_task.get_future()) {}
_future(_task.get_future()), _is_active(false), _spawned(false) {}
// Create a new thread and launch the task on it.
template <typename T> void optional_task<T>::activate() {