lastfm: use std::future instead of boost::future
This commit is contained in:
@@ -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<LastFm::Service::Result>();
|
||||
m_worker = std::future<LastFm::Service::Result>();
|
||||
}
|
||||
|
||||
#endif // HVAE_CURL_CURL_H
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
|
||||
#ifdef HAVE_CURL_CURL_H
|
||||
|
||||
#include <future>
|
||||
#include <memory>
|
||||
#include <boost/thread/future.hpp>
|
||||
|
||||
#include "interfaces.h"
|
||||
#include "lastfm_service.h"
|
||||
@@ -57,7 +57,8 @@ struct Lastfm: Screen<NC::Scrollpad>, Tabbable
|
||||
return;
|
||||
|
||||
m_service = std::shared_ptr<ServiceT>(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<LastFm::Service> m_service;
|
||||
boost::future<LastFm::Service::Result> m_worker;
|
||||
std::future<LastFm::Service::Result> m_worker;
|
||||
};
|
||||
|
||||
extern Lastfm *myLastfm;
|
||||
|
||||
Reference in New Issue
Block a user