Merge remote-tracking branch 'origin/topic/jsiwek/improve_comm_loop'

* origin/topic/jsiwek/improve_comm_loop:
  Add a simple FD_Set wrapper/helper class.
  Fix Pipe copy/assignment to make a copy of flags.
  Fix possible abort on writing to a full pipe.
  Remove timeouts from remote communication loop.
This commit is contained in:
Robin Sommer 2014-09-25 12:46:39 -07:00
commit e9692958f0
22 changed files with 448 additions and 65 deletions

View file

@ -5,6 +5,7 @@
#include <string>
#include <list>
#include "iosource/FD_Set.h"
namespace iosource {
@ -44,7 +45,7 @@ public:
* may block for a little while if all are dry.
*
* @param ts A pointer where to store the timestamp of the input that
* the soonest source has available next.
* the soonest source has available next.
*
* @return The source, or null if no source has input.
*/
@ -113,9 +114,19 @@ private:
struct Source {
IOSource* src;
int fd_read;
int fd_write;
int fd_except;
FD_Set fd_read;
FD_Set fd_write;
FD_Set fd_except;
bool Ready(fd_set* read, fd_set* write, fd_set* except) const
{ return fd_read.Ready(read) || fd_write.Ready(write) ||
fd_except.Ready(except); }
void SetFds(fd_set* read, fd_set* write, fd_set* except,
int* maxx) const;
void Clear()
{ fd_read.Clear(); fd_write.Clear(); fd_except.Clear(); }
};
typedef std::list<Source*> SourceList;