From d98b8ca1c1ce9e87ccda4a0e9ef9cc3676647044 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Wed, 16 Nov 2016 05:39:45 +0100 Subject: [PATCH] lastfm: use std::future instead of boost::future --- src/lastfm.cpp | 7 +++++-- src/lastfm.h | 7 ++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/lastfm.cpp b/src/lastfm.cpp index c96289b..587e435 100644 --- a/src/lastfm.cpp +++ b/src/lastfm.cpp @@ -54,8 +54,11 @@ std::wstring Lastfm::title() void Lastfm::update() { - if (m_worker.valid() && m_worker.is_ready()) + if (m_worker.valid() + && m_worker.wait_for(std::chrono::seconds(0)) == std::future_status::ready) + { getResult(); + } } void Lastfm::switchTo() @@ -84,7 +87,7 @@ void Lastfm::getResult() w.flush(); w.refresh(); // reset m_worker so it's no longer valid - m_worker = boost::future(); + m_worker = std::future(); } #endif // HVAE_CURL_CURL_H diff --git a/src/lastfm.h b/src/lastfm.h index 070ae83..b3b875f 100644 --- a/src/lastfm.h +++ b/src/lastfm.h @@ -25,8 +25,8 @@ #ifdef HAVE_CURL_CURL_H +#include #include -#include #include "interfaces.h" #include "lastfm_service.h" @@ -57,7 +57,8 @@ struct Lastfm: Screen, Tabbable return; m_service = std::shared_ptr(service); - m_worker = boost::async(boost::launch::async, std::bind(&LastFm::Service::fetch, m_service)); + m_worker = std::async(std::launch::async, + std::bind(&LastFm::Service::fetch, m_service)); w.clear(); w << "Fetching information..."; @@ -71,7 +72,7 @@ private: std::wstring m_title; std::shared_ptr m_service; - boost::future m_worker; + std::future m_worker; }; extern Lastfm *myLastfm; -- 2.11.4.GIT