lastfm: use std::future instead of boost::future
This commit is contained in:
@@ -54,8 +54,11 @@ std::wstring Lastfm::title()
|
|||||||
|
|
||||||
void Lastfm::update()
|
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();
|
getResult();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Lastfm::switchTo()
|
void Lastfm::switchTo()
|
||||||
@@ -84,7 +87,7 @@ void Lastfm::getResult()
|
|||||||
w.flush();
|
w.flush();
|
||||||
w.refresh();
|
w.refresh();
|
||||||
// reset m_worker so it's no longer valid
|
// 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
|
#endif // HVAE_CURL_CURL_H
|
||||||
|
|||||||
@@ -25,8 +25,8 @@
|
|||||||
|
|
||||||
#ifdef HAVE_CURL_CURL_H
|
#ifdef HAVE_CURL_CURL_H
|
||||||
|
|
||||||
|
#include <future>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <boost/thread/future.hpp>
|
|
||||||
|
|
||||||
#include "interfaces.h"
|
#include "interfaces.h"
|
||||||
#include "lastfm_service.h"
|
#include "lastfm_service.h"
|
||||||
@@ -57,7 +57,8 @@ struct Lastfm: Screen<NC::Scrollpad>, Tabbable
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
m_service = std::shared_ptr<ServiceT>(service);
|
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.clear();
|
||||||
w << "Fetching information...";
|
w << "Fetching information...";
|
||||||
@@ -71,7 +72,7 @@ private:
|
|||||||
std::wstring m_title;
|
std::wstring m_title;
|
||||||
|
|
||||||
std::shared_ptr<LastFm::Service> m_service;
|
std::shared_ptr<LastFm::Service> m_service;
|
||||||
boost::future<LastFm::Service::Result> m_worker;
|
std::future<LastFm::Service::Result> m_worker;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Lastfm *myLastfm;
|
extern Lastfm *myLastfm;
|
||||||
|
|||||||
Reference in New Issue
Block a user