fix: fix issues in optional_task
This commit is contained in:
parent
6cddf402b7
commit
30760be328
1 changed files with 1 additions and 2 deletions
|
|
@ -20,7 +20,6 @@ public:
|
||||||
template <typename R, typename P>
|
template <typename R, typename P>
|
||||||
auto wait(std::chrono::duration<R, P> dur) -> std::future_status;
|
auto wait(std::chrono::duration<R, P> dur) -> std::future_status;
|
||||||
auto get() -> T;
|
auto get() -> T;
|
||||||
auto is_active() -> bool;
|
|
||||||
void stop(bool force);
|
void stop(bool force);
|
||||||
~optional_task();
|
~optional_task();
|
||||||
};
|
};
|
||||||
|
|
@ -28,7 +27,7 @@ public:
|
||||||
template <typename T>
|
template <typename T>
|
||||||
optional_task<T>::optional_task(std::function<T()> fn)
|
optional_task<T>::optional_task(std::function<T()> fn)
|
||||||
: _task(std::packaged_task<T()>(std::move(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.
|
// Create a new thread and launch the task on it.
|
||||||
template <typename T> void optional_task<T>::activate() {
|
template <typename T> void optional_task<T>::activate() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue