12.3.106 user_flush_output()

Synopsis

     spio_t_error_code
     user_flush_output(
       void *user_data,
       spio_t_bits flush_options
       );

This is the prototype for one of the methods of user defined streams. It is used when SICStus wants to write data to the user defined stream.

Arguments

user_data
The same value as was passed to SP_create_stream().
flush_options
The following bits can be set:
SPIO_DEVICE_FLUSH_OPTION_NONBLOCKING
If this is set, the function should return quickly or with a SPIO_E_WOULD_BLOCK code.

If your user_flush_output will never block, you can ignore this value.

You should return SPIO_E_NOT_SUPPORTED if user_flush_output cannot support non-blocking flush.

Return Value

On success, all buffered data should have been written and SPIO_S_NOERR or some other success code returned.

On failure, return a SPIO error code. Error codes with special meaning for user_flush_output:

SPIO_E_END_OF_FILE
Returned if it is not possible to write more data onto the stream, e.g. some underlying device has been closed.
SPIO_E_WOULD_BLOCK
SPIO_DEVICE_FLUSH_OPTION_NONBLOCKING was set but the operation would block.
SPIO_E_NOT_SUPPORTED
Some unsupported option, e.g. SPIO_DEVICE_FLUSH_OPTION_NONBLOCKING, was passed.

Other error codes may also be returned.

Description

Should ensure that any buffered data is transmitted to its destination. Can be passed as NULL.

See Also

cpg-ref-SP_create_stream. Defining a New Stream.


Send feedback on this subject.