X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fio%2Fwindows%2Fpipe.cpp;fp=source%2Fio%2Fwindows%2Fpipe.cpp;h=02d7f339f6485186b87c5311ef9241f6d0623a5b;hb=609c9a508cfdc7b42c46c4f21d17639204165a00;hp=0000000000000000000000000000000000000000;hpb=b4806214e905752617691f851717033fd3f266c2;p=libs%2Fcore.git diff --git a/source/io/windows/pipe.cpp b/source/io/windows/pipe.cpp new file mode 100644 index 0000000..02d7f33 --- /dev/null +++ b/source/io/windows/pipe.cpp @@ -0,0 +1,28 @@ +#include +#include +#include "handle_private.h" +#include "pipe.h" + +using namespace std; + +namespace Msp { +namespace IO { + +void Pipe::platform_init() +{ + 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); + if(!read_handle) + throw system_error("CreateNamedPipe"); + + *write_handle = CreateFile(name.c_str(), GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0); + if(!write_handle) + { + unsigned err = GetLastError(); + CloseHandle(*read_handle); + throw system_error(format("CreateFile(%s)", name), err); + } +} + +} // namespace IO +} // namespace Msp