X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fio%2Fpipe.cpp;h=639743f4ca79cab6ad1733383d69e5ff77e9556b;hp=12f8fbd3886ea7f269b125691a19b2074ee16d11;hb=f041a31f9a6e19da86a63912e5a8050f216e5bc5;hpb=c2003dc69422262a5c90b3bd73b60b459f563c6e diff --git a/source/io/pipe.cpp b/source/io/pipe.cpp index 12f8fbd..639743f 100644 --- a/source/io/pipe.cpp +++ b/source/io/pipe.cpp @@ -16,6 +16,8 @@ namespace IO { Pipe::Pipe(): reader(read_handle, 1024) { + mode = M_RDWR; + #ifdef WIN32 string name = format("\\\\.\\pipe\\%u.%p", GetCurrentProcessId(), this); *read_handle = CreateNamedPipe(name.c_str(), PIPE_ACCESS_INBOUND|FILE_FLAG_OVERLAPPED, PIPE_TYPE_BYTE, 1, 1024, 1024, 0, 0); @@ -84,5 +86,15 @@ unsigned Pipe::do_read(char *buf, unsigned size) return ret; } +const Handle &Pipe::get_handle(Mode m) +{ + if(m==M_READ) + return read_handle; + else if(m==M_WRITE) + return write_handle; + else + throw invalid_argument("Pipe::get_handle"); +} + } // namespace IO } // namespace Msp