13
0

downloader: use PBD::Thread instead of std::thread

This commit is contained in:
Paul Davis 2022-09-13 14:14:53 -06:00
parent aeccb137fd
commit d087cd9465
2 changed files with 5 additions and 4 deletions

View File

@ -82,14 +82,13 @@ Downloader::start ()
_cancel = false;
_status = 0; /* unknown at this point */
thr = std::thread (&Downloader::download, this);
return 0;
return 0 != (thread = PBD::Thread::create (boost::bind (&Downloader::download, this)));
}
void
Downloader::cleanup ()
{
thr.join ();
thread->join ();
}
void

View File

@ -29,6 +29,8 @@
namespace PBD {
class Thread;
class LIBPBD_API Downloader {
public:
Downloader (std::string const & url, std::string const & destdir);
@ -58,7 +60,7 @@ class LIBPBD_API Downloader {
std::atomic<uint64_t> _download_size; /* read-only from requestor thread */
std::atomic<uint64_t> _downloaded; /* read-only from requestor thread */
std::atomic<int> _status;
std::thread thr;
PBD::Thread* thread;
void download ();
};