-#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);
- 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(*handle[0]);
- throw system_error(format("CreateFile(%s)", name), err);
- }
-#else
- int pipe_fd[2];
- if(pipe(pipe_fd)==-1)
- throw system_error("pipe");
-
- *read_handle = pipe_fd[0];
- *write_handle = pipe_fd[1];
-#endif