# # patch "netxx_pipe.cc" # from [a56db41c4d2ad914bc3b4621fd1f0d9a0c0125f8] # to [f2f865d07427d8a9728cd9bd35751bdf0eb5789a] # # patch "netxx_pipe.hh" # from [288763387ebbd715f7c16b987aa2c81c7c74913a] # to [10a3e9ac278675359a3a56ea78cbb3a35c0f4e23] # =============================================== --- netxx_pipe.cc a56db41c4d2ad914bc3b4621fd1f0d9a0c0125f8 +++ netxx_pipe.cc f2f865d07427d8a9728cd9bd35751bdf0eb5789a @@ -186,12 +186,12 @@ std::string result; char buf[1024]; Netxx::signed_size_type bytes; - Netxx::Probe probe; + Netxx::PipeCompatibleProbe probe; Netxx::Timeout timeout(2L), instant(0,1); probe.clear(); probe.add(pipe, Netxx::Probe::ready_read | Netxx::Probe::ready_oobd); Netxx::Probe::result_type res = probe.ready(timeout); - L(F("probe %d\n") % res.first); + L(F("probe %d/%d\n") % res.first % res.second); do { bytes=pipe.read(buf,sizeof buf); if (bytes<=0) break; =============================================== --- netxx_pipe.hh 288763387ebbd715f7c16b987aa2c81c7c74913a +++ netxx_pipe.hh 10a3e9ac278675359a3a56ea78cbb3a35c0f4e23 @@ -29,8 +29,23 @@ #ifdef WIN32 class PipeCompatibleProbe : public Probe - { - } + { // We need to make sure that only pipes are connected, if Streams are + // connected the old Probe functions still apply + // use WriteFileEx/ReadFileEx with Overlap? + bool is_pipe; + PipeStream *pipe; + public: + PipeCompatibleProbe() : is_pipe(), pipe() {} + void clear() + { if (is_pipe) { pipe=0; is_pipe=false; } else Probe::clear(); } + result_type ready(const Timeout &timeout=Timeout(), ready_type rt=ready_none); + void add(const PipeStream &ps, ready_type rt=ready_none); + void remove(const PipeStream &ps); + template void add (const T &t, ready_type rt=ready_none) + { if (is_pipe) throw std::runtime_error("stream added to a pipe probe"); + Probe::add(t,rt); + } + }; #else typedef Probe PipeCompatibleProbe; #endif