## GskStreamQueue

GskStreamQueue

## 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

## 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.
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.

### 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.

### 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.

### 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.

### GSK_STREAM_QUEUE_READ_EMPTY_HOOK()

    #define             GSK_STREAM_QUEUE_READ_EMPTY_HOOK(queue)

GskHook which notifies as long as the queue's supply of readable streams is empty.

`queue` : | queue whose hook should be returned.

### gsk_stream_queue_trap_read_empty()

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

Provide a function that will be call as long as there are no streams to read from.

`queue` : | the queue to get notification about.
`func` : | function to invoke when the queue is empty, and which should return whether it wishes to continue trapping the event.
`shutdown` : | called when the queue is no longer readable, should return FALSE.
`data` : | data to pass to `func`, `shutdown` and `destroy`.
`destroy` : | called when the func and shutdown can no longer be invoked.

### gsk_stream_queue_untrap_read_empty()

    #define             gsk_stream_queue_untrap_read_empty(queue)

Remove the trap set by `gsk_stream_queue_trap_read_empty()`.

The destroy function, if any, will be called (possibly not immediately)

`queue` : | the queue to stop getting notification about.

### GSK_STREAM_QUEUE_WRITE_EMPTY_HOOK()

    #define             GSK_STREAM_QUEUE_WRITE_EMPTY_HOOK(queue)

GskHook which notifies as long as the queue's supply of writable streams is empty.

`queue` : | queue whose hook should be returned. Provide a function that will be call as long as there are no streams to write to.

### gsk_stream_queue_trap_write_empty()

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

`queue` : |
`func` : |
`shutdown` : |
`data` : |
`destroy` : |

### gsk_stream_queue_untrap_write_empty()

    #define             gsk_stream_queue_untrap_write_empty(queue)

Remove the trap set by `gsk_stream_queue_trap_write_empty()`.

The destroy function, if any, will be called (possibly not immediately)

`queue` : | the queue to stop getting notification about.