# Attributes for CmtGetTSQAttribute and CmtSetTSQAttribute

This topic describes the attributes that you can use with the multithreading functions CmtGetTSQAttribute and CmtSetTSQAttribute:

Reader Active | ATTR_TSQ_READER_ACTIVE
Writer Active | ATTR_TSQ_WRITER_ACTIVE
Queue Size | ATTR_TSQ_QUEUE_SIZE
Item Size | ATTR_TSQ_ITEM_SIZE
Items in Queue | ATTR_TSQ_ITEMS_IN_QUEUE
Queue Free Space | ATTR_TSQ_QUEUE_FREE_SPACE
Queue Options | ATTR_TSQ_QUEUE_OPTIONS
Growth Increment | ATTR_TSQ_GROWTH_INCREMENT
Access Deny | ATTR_TSQ_ACCESS_DENY

ATTR_TSQ_READER_ACTIVE

Type: int

Restrictions: Not settable.

Description: This attribute specifies whether a reader thread is currently active. A reader thread is active when it is inside a call to CmtReadTSQData or when it has obtained the read pointer from CmtGetTSQReadPtr and has not released it with CmtReleaseTSQReadPtr.

Values: | Name | Value
| FALSE | 0
| TRUE | 1

ATTR_TSQ_WRITER_ACTIVE

Type: int

Restrictions: Not settable.

Description: This attribute specifies whether a writer thread is currently active. A writer thread is active when it is inside a call to CmtWriteTSQData or when it has obtained the write pointer from CmtGetTSQWritePtr and has not released it with CmtReleaseTSQWritePtr.

Values: | Name | Value
| FALSE | 0
| TRUE | 1

ATTR_TSQ_QUEUE_SIZE

Type: int

Description: This attribute specifies the size of the queue in number of items. If you set this attribute while a writer thread is active, CmtSetTSQAttribute waits for the writer thread to finish its operation before resizing the queue.

ATTR_TSQ_ITEM_SIZE

Type: int

Restrictions: Not settable.

Description: This attribute specifies the size, in bytes, of a single queue item.

ATTR_TSQ_ITEMS_IN_QUEUE

Type: int

Restrictions: Not settable.

Description: This attribute specifies the number of items available for reading from the queue.

ATTR_TSQ_QUEUE_FREE_SPACE

Type: int

Restrictions: Not settable.

Description: This attribute specifies the amount of space, in number of items, available for writing to the queue.

ATTR_TSQ_QUEUE_OPTIONS

Type: int

Restrictions: Not settable.

Description: This attribute specifies the configuration options for the thread safe queue. The configuration options are flag values that are set through the options parameter to the CmtNewTSQ function.

Values:

Defined Constant | Value/ Description
OPT_TSQ_DYNAMIC_SIZE | 1 The thread safe queue grows when it is full and a write operation occurs.
OPT_TSQ_AUTO_FLUSH_ALL | 2 The thread safe queue removes all old data when it is full and a write operation occurs.
OPT_TSQ_AUTO_FLUSH_EXACT | 4 The thread safe queue removes enough old data to fit the new data when it is full and a write operation occurs.

ATTR_TSQ_GROWTH_INCREMENT

Type: int

Description: This attribute specifies the number of items in the growth increment. When a dynamically sizeable thread safe queue is full and a thread writes items to it, the queue grows its buffer by the smallest multiple of the growth increment needed to hold the new data. You can set this attribute only on queues that are dynamically sizable.

ATTR_TSQ_ACCESS_DENY

Type: int

Description: This attribute specifies what operations are not allowed on the queue. The values are bit-flags that can be OR'd together to prevent more than one type of operation. Use this attribute to prevent threads from accessing the queue when you are shutting down the application.

Values

Defined Constant | Value/ Description
VAL_TSQ_ACCESS_DENY_NONE | x00000000 Allow all operations on the thread safe queue.
VAL_TSQ_ACCESS_DENY_READ | x00000001 Deny read access to the thread safe queue. CmtReadTSQData, CmtGetTSQReadPtr, and CmtReleaseTSQReadPtr return errors when read access is denied.
VAL_TSQ_ACCESS_DENY_WRITE | x00000002 Deny write access to the thread safe queue. CmtWriteTSQData, CmtGetTSQWritePtr, and CmtReleaseTSQWritePtr return errors when write access is denied.
VAL_TSQ_ACCESS_DENY_FLUSH | x00000004 Do not allow the queue to be flushed. CmtFlushTSQ returns an error when flush access is denied.
VAL_TSQ_ACCESS_DENY_READWRITE | x00000003 Deny read and write access to the queue.
VAL_TSQ_ACCESS_DENY_ALL | XFFFFFFFF Deny all restrictable access to the queue.