Attempt to generalize the “feeder” part of a
Channel: an object which can be
read from and closed, but is reading from a buffer fed by another thread. The
read operations are blocking and can have a timeout set.
A buffer that obeys normal read (with timeout) & close semantics for a file or socket, but is fed data from another thread. This is used by
list of weak references to the object (if defined)
Close this pipe object. Future calls to
readafter the buffer has been emptied will return immediately with an empty string.
Clear out the buffer and return all data that was in it.
Returns: any data that was in the buffer prior to clearing it out, as a
Feed new data into this pipe. This method is assumed to be called from a separate thread, so synchronization is done.
Parameters: data – the data to add, as a
Read data from the pipe. The return value is a string representing the data received. The maximum amount of data to be received at once is specified by
nbytes. If a string of length zero is returned, the pipe has been closed.
timeoutargument can be a nonnegative float expressing seconds, or
Nonefor no timeout. If a float is given, a
PipeTimeoutwill be raised if the timeout period value has elapsed before any data arrives.
the read data, as a
PipeTimeout – if a timeout was specified and no data was ready before that timeout
Returns true if data is buffered and ready to be read from this feeder. A
Falseresult does not mean that the feeder has closed; it means you may need to wait before more data arrives.
readcall would immediately return at least one byte;