Share via


ISoftUSBEndpoint::FreeOUTQueue Method

The FreeOUTQueue method frees the list of SOFTUSB_OUT_TRANSFER structures that the ISoftUSBEndpoint::DrainOUTQueue method previously returned.

Syntax

void FreeOUTQueue(
  [in]  void *pTransfers
);

Parameters

  • pTransfers [in]
    A pointer to the list that DrainOUTQueue returned and that FreeOUTQueue should free. This parameter can be NULL.

Return Value

FreeOUTQueue returns S_OK if the operation succeeds.

Remarks

The caller can also call the ISoftUSBEndpoint::PurgeINQueue, ISoftUSBEndpoint::PurgeOUTQueue, ISoftUSBEndpoint::PurgeOUTQueueOlderThan, and ISoftUSBEndpoint::QueueINData methods to manage data queues.

The following C++ code example shows how to free the memory that is allocated by a call to DrainOUTQueue.

HRESULT               hr                = S_OK;
ULONG                 ulNoOfQueuedItems = 0; // The number of items that are currently in the queue
ULONG                 ulTransfers       = 1; // Read only one transfer at a time
SOFTUSB_OUT_TRANSFER *pOUTTransfer      = NULL;
    // Get the OUT data
 hr = m_piOUTEndpoint->DrainOUTQueue(ulTransfers, 
        &ulNoOfQueuedItems, 
        &pOUTTransfer);
 
 if(FAILED(hr))
 goto Exit;

 //Process the data
 hr = ProcessOUTData(pOUTTransfer);
 if(FAILED(hr))
  goto Exit;

    // Free the memory that pOUTTransfer uses  
 hr = m_piINEndpoint ->FreeOUTQueue(pOUTTransfer);
 if(FAILED(hr))
 goto Exit;
 pOUTTransfer = NULL;


Exit:
    // If there was a failure pOUTTransfer will be non-NULL 
    // and needs to be freed
 if (NULL != pOUTTransfer)
    {
        // Free the memory that pOUTTransfer uses  
 hr = m_piINEndpoint ->FreeOUTQueue(pOUTTransfer);
 if(FAILED(hr))
 goto Exit;
 pOUTTransfer = NULL;
    }

 return hr;

Requirements

Header

SoftUSBif.h

See Also

ISoftUSBEndpoint

ISoftUSBEndpoint::DrainOUTQueue

ISoftUSBEndpoint::PurgeINQueue

ISoftUSBEndpoint::PurgeOUTQueue

ISoftUSBEndpoint::PurgeOUTQueueOlderThan

ISoftUSBEndpoint::QueueINData

SOFTUSB_OUT_TRANSFER

 

 

Send comments about this topic to Microsoft

Build date: 9/21/2010