# DisposeDataStream

Cancels a data stream.

### Synopsis

`int32 DisposeDataStream (Item msgItem, DSStreamCBPtr streamCBPtr)`

### Description

Cancels a data stream by sending a message to the DataStreamer to close the stream. `DisposeDataStream()` also cancels the thread allocated for the stream and releases its stack block and context block.

### Arguments

`msgItem`
  Item of the request message.

`streamCBPtr`
  Pointer to the stream context block.

### Return Value

These values are returned if the DataStreamer encounters an error while processing the message request:

kDSInvalidDSRequest
  Invalid message (`whatToDo` set to invalid value)

kDSNoReplyPortErr
  Could not locate item of the reply port

-1
  Could not locate pointer to msgItem

(Portfolio Error Code)
  `SendMsg()` or `WaitPort()` failed

The DataStreamer checks the validity of messages only if message checking was enabled when the DataStreamer is compiled (if the `VALIDATE_REQUEST_CODE` symbol is enabled).

See "Error Messages" in the 3DO Portfolio Reference Manual for a listing of error messages returned by `SendMsg()` and `WaitPort()`.

### Associated Files

DataStream.h

### See Also

`NewDataStream`