LabWindows/CVI

Content Type
Programming Language
Current manual
Table of Contents

CmtFlushTSQ

int CmtFlushTSQ (CmtTSQHandle 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 CmtTSQHandle The handle you obtained from CmtNewTSQ to identify the thread safe queue.
itemsToFlush int 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 int 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 int 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.

Additional Information

Library: Utility Library

Include file: utility.h

LabWindows/CVI compatibility: LabWindows/CVI 5.5 and later

Examples

Refer to the following examples that use the CmtFlushTSQ function:

  • apps\daqmthread\daqMT.cws

    Open example
  • utility\threading\ThreadSafeQueue\DirectPtrAccess\DirectPtrAccess.cws

    Open example
  • utility\threading\ThreadSafeQueue\Overflow\Overflow.cws

    Open example
Was this information helpful?

Log in to get a better experience