SIO_delete
Application Program Interface
2-393
C Interface
Syntax
status = SIO_delete(stream);
Parameters
SIO_Handle stream;
/* stream object */
Return Value
Int
status;
/* result of operation */
Description
SIO_delete idles the device before freeing the stream object and buffers.
If the stream being deleted was opened for input, then any pending input
data is discarded. If the stream being deleted was opened for output, the
method for handling data is determined by the value of the flush field in
the SIO_Attrs structure (passed in with SIO_create). If flush is TRUE,
SIO_delete discards all pending data and returns without blocking. If
flush is FALSE, SIO_delete blocks until all pending data has been
processed by the stream.
SIO_delete returns SYS_OK if and only if the operation is successful.
SIO_delete calls MEM_free to delete a stream. MEM_free must acquire
a lock to the memory before proceeding. If another task already holds a
lock to the memory, then there is a context switch.
Internally, SIO_delete first calls Dxx_idle to idle the device. Then it calls
Dxx_close.
Constraints and
Calling Context
❏
SIO_delete cannot be called from a SWI or HWI.
❏
No check is performed to prevent SIO_delete from being used on a
statically-created object. If a program attempts to delete a stream
object that was created using Tconf, SYS_error is called.
❏
In SIO_ISSUERECLAIM mode, all buffers issued to a stream must
be reclaimed before SIO_delete is called. Failing to reclaim such
buffers causes a memory leak.
See Also
SIO_create
SIO_flush
SIO_idle
Dxx_idle
Dxx_close
SIO_delete
Close a stream and free its buffers