## GskStreamQueue

GskStreamQueue — a stream that concatenates inputs and outputs.

## Synopsis

    GskStreamQueue* gsk_stream_queue_new        (gboolean is_readable,
                                                 gboolean is_writable);
    void        gsk_stream_queue_append_read_stream
                                                (GskStreamQueue *queue,
                                                 GskStream *substream);
    void        gsk_stream_queue_append_write_stream
                                                (GskStreamQueue *queue,
                                                 GskStream *substream);
    void        gsk_stream_queue_no_more_read_streams
                                                (GskStreamQueue *queue);
    void        gsk_stream_queue_no_more_write_streams
                                                (GskStreamQueue *queue);
    #define     GSK_STREAM_QUEUE_READ_EMPTY_HOOK(queue)
    #define     gsk_stream_queue_trap_read_empty(queue, func, shutdown, data, destroy)
    #define     gsk_stream_queue_untrap_read_empty(queue)
    #define     GSK_STREAM_QUEUE_WRITE_EMPTY_HOOK(queue)
    #define     gsk_stream_queue_trap_write_empty(queue, func, shutdown, data, destroy)
    #define     gsk_stream_queue_untrap_write_empty(queue)

## Description

The queue stream concatenates other streams together. For example, a queue of inputs will be drained in sequence. Likewise, a queue of outputs will be filled in sequence.

The lifetime of this stream is that you append as many read or write streams as you wish (using `gsk_stream_queue_append_read_stream()` and `gsk_stream_queue_append_write_stream()`) then eventually indicate that you are done appending with `gsk_stream_queue_no_more_read_streams()` and `gsk_stream_queue_no_more_write_streams()`).

## Details

### gsk_stream_queue_new ()

    GskStreamQueue* gsk_stream_queue_new        (gboolean is_readable,
                                                 gboolean is_writable);

Create a stream which can have other streams queueenated to either its read or write ends.

`is_readable`: whether the read can have readable streamss appended to it. `is_writable`: whether the read can have writable streamss appended to it.

`is_readable` : |
`is_writable` : |
Returns : | the newly allocated stream.

### gsk_stream_queue_append_read_stream ()

    void        gsk_stream_queue_append_read_stream
                                                (GskStreamQueue *queue,
                                                 GskStream *substream);

Append a readable stream to a queue-stream. It will be read in the order in which it was appended.

`queue`: the larger stream. `substream`: the stream whose data will be read by `queue`. Note that this function increments the ref-count on substream, so you must `g_object_unref()` it also.

`queue` : |
`substream` : |

### gsk_stream_queue_append_write_stream ()

    void        gsk_stream_queue_append_write_stream
                                                (GskStreamQueue *queue,
                                                 GskStream *substream);

Append a writable stream to a queue-stream. It will be written to in the order in which it was appended.

`queue`: the larger stream. `substream`: the stream which will be written to by the `queue`. Note that this function increments the ref-count on substream, so you must `g_object_unref()` it also.

`queue` : |
`substream` : |

### gsk_stream_queue_no_more_read_streams ()

    void        gsk_stream_queue_no_more_read_streams
                                                (GskStreamQueue *queue);

Indicate that you are done added substreams to a queue-stream. When the last stream shuts down for reading, and all the buffered data has been read from queue, then this queue-stream will shut down.

`queue`: the stream to which no further streams can be appended.

`queue` : |

### gsk_stream_queue_no_more_write_streams ()

    void        gsk_stream_queue_no_more_write_streams
                                                (GskStreamQueue *queue);

Indicate that you are done added substreams to a queue-stream. When the last stream shuts down for writeing, then this queue-stream will shut down.

`queue`: the stream to which no further streams can be appended.

`queue` : |

### GSK_STREAM_QUEUE_READ_EMPTY_HOOK()

    #define     GSK_STREAM_QUEUE_READ_EMPTY_HOOK(queue)

Get the hook which notifies when there are no more streams to read from.

`queue` : |

### gsk_stream_queue_trap_read_empty()

    #define     gsk_stream_queue_trap_read_empty(queue, func, shutdown, data, destroy)

Trap notification that the queue is out of readable streams.

You might wish to do this to produce streams on demand for the queue.

`queue` : | the queue to watch.
`func` : | function to call when there are no more readable streams.
`shutdown` : | function to call once no more readable streams are needed.
`data` : | data to pass to function (as the second argument)
`destroy` : | called when the trap is removed.

### gsk_stream_queue_untrap_read_empty()

    #define     gsk_stream_queue_untrap_read_empty(queue)

Remove a trap of notification that the queue is out of readable streams.

`queue` : | the queue to stop watching.

### GSK_STREAM_QUEUE_WRITE_EMPTY_HOOK()

    #define     GSK_STREAM_QUEUE_WRITE_EMPTY_HOOK(queue)

Get the hook which notifies when there are no more streams to write to.

`queue` : | the queue to query.

### gsk_stream_queue_trap_write_empty()

    #define     gsk_stream_queue_trap_write_empty(queue, func, shutdown, data, destroy)

Trap notification that the queue is out of writable streams.

You might wish to do this to produce streams on demand for the queue.

`queue` : | the queue to watch.
`func` : | function to call when there are no more writable streams.
`shutdown` : | function to call once no more writable streams are needed.
`data` : | data to pass to function (as the second argument)
`destroy` : | called when the trap is removed.

### gsk_stream_queue_untrap_write_empty()

    #define     gsk_stream_queue_untrap_write_empty(queue)

Remove a trap of notification that the queue is out of writable streams.

`queue` : | the queue to stop watching.

## See Also

none