# CmtFlushTSQ

int CmtFlushTSQ (int queueHandle, int itemsToFlush, int *itemsFlushed);

## Purpose

Removes items from the thread safe queue.

You can use this function to reset the queue to a known state when you lose data due to queue overflow. This function waits until threads that are currently reading from or writing to the thread safe queue finish their operations before flushing any items.

## Parameters

Input
Name | Type | Description
queueHandle | integer | The handle you obtained from CmtNewTSQ to identify the thread safe queue.
itemsToFlush | integer | The number of items to remove from the thread safe queue. Pass TSQ_FLUSH_ALL to remove all of the items from the queue.
Output
Name | Type | Description
itemsFlushed | integer (passed by reference) | Returns the number of items that the thread safe queue removed from the beginning of the queue to make room for the new data. Pass NULL if you do not want this value.

## Return Value

Name | Type | Description
CmtStatus | integer | The CmtStatus code that the function call returns. This function returns 0 to indicate success and negative values to indicate failure. Pass the CmtStatus code to CmtGetErrorMessage to get a description of the error code.