poll both stdin and mpd using one select()

this allows for immediate reading mpd events
This commit is contained in:
Andrzej Rybczak
2009-10-25 20:44:07 +01:00
parent 08f4459b54
commit dd04406ee5
22 changed files with 138 additions and 75 deletions

View File

@@ -21,12 +21,6 @@
#ifndef _MPDPP_H
#define _MPDPP_H
#ifdef WIN32
# include <winsock.h>
#else
# include <sys/select.h>
#endif
#include <vector>
#include <mpd/client.h>
@@ -98,7 +92,10 @@ namespace MPD
int GetPort() { return itsPort; }
float Version() const;
bool SupportsIdle() const { return supportsIdle; }
void OrderDataFetching() { hasData = 1; }
int GetFD() const { return itsFD; }
void SetHostname(const std::string &);
void SetPort(int port) { itsPort = port; }
@@ -213,7 +210,7 @@ namespace MPD
private:
void GoIdle();
mpd_idle GoBusy();
int GoBusy();
int CheckForErrors();
@@ -224,10 +221,10 @@ namespace MPD
int itsErrorCode;
size_t itsMaxPlaylistLength;
fd_set itsPoll;
int itsFD;
bool isIdle;
bool supportsIdle;
bool hasData;
std::string itsHost;
int itsPort;