lyrics: use pthread_t instead of pthread_t *
This commit is contained in:
@@ -72,7 +72,7 @@ void Lyrics::Update()
|
||||
if (ReadyToTake)
|
||||
Take();
|
||||
|
||||
if (Downloader)
|
||||
if (DownloadInProgress)
|
||||
{
|
||||
w->Flush();
|
||||
w->Refresh();
|
||||
@@ -174,7 +174,7 @@ void *Lyrics::Download()
|
||||
void Lyrics::Load()
|
||||
{
|
||||
# ifdef HAVE_CURL_CURL_H
|
||||
if (Downloader)
|
||||
if (DownloadInProgress)
|
||||
return;
|
||||
# endif // HAVE_CURL_CURL_H
|
||||
if (itsSong.GetArtist().empty() || itsSong.GetTitle().empty())
|
||||
@@ -214,8 +214,8 @@ void Lyrics::Load()
|
||||
else
|
||||
{
|
||||
# ifdef HAVE_CURL_CURL_H
|
||||
Downloader = new pthread_t;
|
||||
pthread_create(Downloader, 0, DownloadWrapper, this);
|
||||
pthread_create(&Downloader, 0, DownloadWrapper, this);
|
||||
DownloadInProgress = 1;
|
||||
# else
|
||||
*w << "Local lyrics not found. As ncmpcpp has been compiled without curl support, you can put appropriate lyrics into " << Folder << " directory (file syntax is \"$ARTIST - $TITLE.txt\") or recompile ncmpcpp with curl support.";
|
||||
w->Flush();
|
||||
@@ -278,11 +278,10 @@ void Lyrics::Refetch()
|
||||
void Lyrics::Take()
|
||||
{
|
||||
assert(ReadyToTake);
|
||||
pthread_join(*Downloader, 0);
|
||||
pthread_join(Downloader, 0);
|
||||
w->Flush();
|
||||
w->Refresh();
|
||||
delete Downloader;
|
||||
Downloader = 0;
|
||||
DownloadInProgress = 0;
|
||||
ReadyToTake = 0;
|
||||
}
|
||||
#endif // HAVE_CURL_CURL_H
|
||||
|
||||
@@ -30,7 +30,7 @@ class Lyrics : public Screen<Scrollpad>
|
||||
public:
|
||||
Lyrics() : ReloadNP(0),
|
||||
# ifdef HAVE_CURL_CURL_H
|
||||
ReadyToTake(0), Downloader(0),
|
||||
ReadyToTake(0), DownloadInProgress(0),
|
||||
# endif // HAVE_CURL_CURL_H
|
||||
itsScrollBegin(0) { }
|
||||
|
||||
@@ -63,7 +63,6 @@ class Lyrics : public Screen<Scrollpad>
|
||||
void Load();
|
||||
|
||||
std::string itsFilenamePath;
|
||||
|
||||
static const std::string Folder;
|
||||
|
||||
# ifdef HAVE_CURL_CURL_H
|
||||
@@ -72,7 +71,8 @@ class Lyrics : public Screen<Scrollpad>
|
||||
|
||||
void Take();
|
||||
bool ReadyToTake;
|
||||
pthread_t *Downloader;
|
||||
bool DownloadInProgress;
|
||||
pthread_t Downloader;
|
||||
# endif // HAVE_CURL_CURL_H
|
||||
|
||||
size_t itsScrollBegin;
|
||||
|
||||
Reference in New Issue
Block a user