X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fio%2Fpipe.cpp;h=d1bc5c4177deb590e539bbf2f96087f15b64c770;hb=26636afce9c85c6c78c7267ebcd18d165825024b;hp=f52801cd834e550199a808ab99020adcac8d6a27;hpb=a27ea413e861a30c61b29d77d58ea3d15a9de6a1;p=libs%2Fcore.git diff --git a/source/io/pipe.cpp b/source/io/pipe.cpp index f52801c..d1bc5c4 100644 --- a/source/io/pipe.cpp +++ b/source/io/pipe.cpp @@ -1,9 +1,10 @@ #ifndef WIN32 #include #include +#include #endif #include -#include +#include #include "handle_private.h" #include "pipe.h" @@ -21,7 +22,7 @@ Pipe::Pipe(): if(!handle[0]) throw system_error("CreateNamedPipe"); - *handle[1] = CreateFile(name.c_str(), GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0); + *handle[1] = CreateFile(name.c_str(), GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0); if(!handle[1]) { unsigned err = GetLastError(); @@ -41,18 +42,12 @@ Pipe::Pipe(): } Pipe::~Pipe() -{ - close(); -} - -void Pipe::close() { set_events(P_NONE); signal_flush_required.emit(); sys_close(handle[0]); sys_close(handle[1]); - signal_closed.emit(); } void Pipe::set_block(bool b) @@ -83,12 +78,8 @@ unsigned Pipe::do_read(char *buf, unsigned size) return 0; unsigned ret = reader.read(buf, size); - if(ret==0) - { - eof_flag = true; - signal_end_of_file.emit(); - } + set_eof(); return ret; }