[Lldb-commits] [PATCH] Enable PipeWindows to support reading with timeout, and fix broken build of llgs.
zturner at google.com
Thu Dec 4 14:21:57 PST 2014
I thought about something like that too, but then I wondered if it's really
necessary. In Windows we need to open a named pipe internally even when
the user requests anonymous pipe, because a named pipe is the only way to
achieve something like select. So that would make that scenario really
It seems like we can do the same thing as you've suggested but without the
Error Create(llvm::StringRef name); // name is optional
Error OpenReader(llvm::StringRef name); // name is required
Error OpenWriter(llvm::StringRef name); // name is required
Error Read(buf, size, bytes_read);
Error ReadWithTimeout(buf, size, timeout, bytes_read);
I would prefer not having to specify the non-blocking option. The reason
is that if user doesn't specify nonblocking, then ReadWithTimeout is an
invalid method to call. And if they do specify non-blocking, the
implementation of Read() changes.
But we can always support both methods if we always open the pipe
nonblocking. In read you just implement the block yourself even though the
pipe is opened with O_NONBLOCK
On Thu Dec 04 2014 at 2:15:18 PM Oleksiy Vyalov <ovyalov at google.com> wrote:
> I'm thinking about having Pipe class as a base class with derived
> AnonymousPipe and NamedPipe.
> AnonymousPipe will be almost replica of existing Pipe class with custom
> Open(OpenOptions opts) method.
> NamedPipe will have following own methods:
> enum OpenOptions
> eOpenOptionNonBlocking = (1u << 0), // Non-blocking reads
> eOpenChildProcessesInherit = (1u << 1) // Child processes
> explicit NamedPipe(const char* name);
> bool Create(); //mkfifo
> bool Delete(); //Close() & unlink
> bool OpenReader(OpenOptions opts);
> bool OpenWriter(OpenOptions opts);
> For named pipes we don't need to have both reader & writer opened in the
> same processes - so, that's why I think we may need separate open methods.
> In order to read with timeout pipe should be opened in non-blocking mode -
> on Windows you may use PIPE_NOWAIT if such option is set.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the lldb-commits