use pthread_t * handlers rather than pthread_t
pthread-win32 doesn't accept assigning zero to pthread_t type, so we need to use pointers instead. this is more semantic anyway.
This commit is contained in:
14
src/info.cpp
14
src/info.cpp
@@ -27,9 +27,6 @@
|
||||
# else
|
||||
# include <sys/stat.h>
|
||||
# endif // WIN32
|
||||
# ifdef HAVE_PTHREAD_H
|
||||
# include <pthread.h>
|
||||
# endif
|
||||
# include "curl/curl.h"
|
||||
# include "helpers.h"
|
||||
#endif
|
||||
@@ -53,7 +50,7 @@ const std::string Info::Folder = home_folder + "/.ncmpcpp/artists";
|
||||
bool Info::ArtistReady = 0;
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_t Info::Downloader = 0;
|
||||
pthread_t *Info::Downloader = 0;
|
||||
#endif // HAVE_PTHREAD_H
|
||||
|
||||
#endif // HAVE_CURL_CURL_H
|
||||
@@ -83,8 +80,9 @@ void Info::Update()
|
||||
if (!ArtistReady)
|
||||
return;
|
||||
|
||||
pthread_join(Downloader, NULL);
|
||||
pthread_join(*Downloader, NULL);
|
||||
w->Flush();
|
||||
delete Downloader;
|
||||
Downloader = 0;
|
||||
ArtistReady = 0;
|
||||
}
|
||||
@@ -158,8 +156,12 @@ void Info::GetArtist()
|
||||
static_cast<Window &>(*w) << "Fetching artist's info...";
|
||||
# ifdef HAVE_PTHREAD_H
|
||||
if (!Downloader)
|
||||
pthread_create(&Downloader, NULL, PrepareArtist, artist);
|
||||
{
|
||||
Downloader = new pthread_t;
|
||||
pthread_create(Downloader, NULL, PrepareArtist, artist);
|
||||
}
|
||||
# else
|
||||
w->Window::Refresh();
|
||||
PrepareArtist(&artist);
|
||||
w->Flush();
|
||||
# endif // HAVE_PTHREAD_H
|
||||
|
||||
Reference in New Issue
Block a user