ctThrdQueueOnClose
Short Name
ctThrdQueueOnClose()
Type
Threading function
Declaration
NINT ctThrdQueueOpen()NINT ctThrdQueueOnClose(NINT qid,void (*onClose)(void * buffer, NINT msglen))
Description
ctThrdQueueOnClose() sets a function pointer onClose, which is called during ctThrdQueueClose() for each message that remains in the queue. This allows for processing of any final messages if the close is not otherwise synchronized with writes to the queue. For non-direct messages (such as written using ctThrdQueueWrite), the buffer passed to the registered callback is managed by ctThrdQueueClose() and should not be freed by the callback.
Note: The application is responsible for managing the buffers written by the ctThrdQueueWriteDirect(), and ctThrdLIFOWriteDirect() calls. To avoid memory/buffer errors, use either the original Queue read/write calls or the direct calls, but do not mix calls from both pairs.
Passing a function pointer replaces any previously set callback. Using a NULL function pointer removes the callback.
The returned value is an error indicator.
Return Values
Value |
Symbolic Constant |
Explanation |
---|---|---|
0 |
NO_ERROR |
Successful function. |
90 |
NQUE_ERR |
Invalid qid. |
514 |
CQUE_ERR |
Queue is closed. |
See c-tree Plus Error Codes for a complete listing of valid c-tree Plus error values.
See Also