view src/lib/istream-tee.h @ 19604:c996bc091c6b

master: Do not close stdout if going foreground This lets one to use /dev/stdout for logging. Mainly useful for testing purposes where we can generate log output to stdout and use tee to write it to a file for later examination.
author Aki Tuomi <aki.tuomi@dovecot.fi>
date Mon, 18 Jan 2016 15:50:23 +0200
parents 9d878b1dc028
children
line wrap: on
line source

#ifndef ISTREAM_TEE_H
#define ISTREAM_TEE_H

/* Tee can be used to create multiple child input streams which can access
   a single non-blocking input stream in a way that data isn't removed from
   memory until all child streams have consumed the input.

   If the stream's buffer gets full because some child isn't consuming the
   data, other streams get returned 0 by i_stream_read(). */
struct tee_istream *tee_i_stream_create(struct istream *input);
/* Returns TRUE if last read() operation returned 0, because it was waiting
   for another tee stream to read more of its data. */
bool tee_i_stream_child_is_waiting(struct istream *input);

struct istream *tee_i_stream_create_child(struct tee_istream *tee);

#endif