FairCom Corporation


F.72 ctThrdQueueRead


Read a queue message.

Short Name

ctThrdQueueRead

TYPE

Threading function

DECLARATION

NINT ctThrdQueueRead(NINT qid, pVOID buffer, NINT buflen, LONG timeout)

DESCRIPTION

Read a queue message into buffer with maximum length buflen. If buffer is NULL and/or buflen is smaller than the actual message, the message is still removed from the queue, and as much as possible is placed into the buffer.

RETURN

In the case of a NULL or an insufficient buffer, ctThrdQueueRead returns TQUE_ERR. If no message is available to be read within the interval specified in milliseconds by the timeout parameter, ctThrdQueueRead returns NTIM_ERR. If more than one thread is reading the queue with an intermediate timeout parameter, i.e., greater than ctNOWAIT and less than ctWAITFOREVER, the length of time before a NTIM_ERR is returned is not accurate and such usage should not be attempted.

Value
Symbolic Constant
Explanation
0
NO_ERROR
Successful function.
90
NQUE_ERR
Invalid qid.
156
NTIM_ERR
block in use by another thread. Timeout error.
514
CQUE_ERR
Queue could not be closed.
636
TSYF_ERR
block get failed.
638
TQUE_ERR
Queue message truncated to fit.

See Appendix A "c-tree Plus Error Codes" of the c-tree Plus Programmer's Reference Guide for a complete listing of valid c-tree Plus error values.

EXAMPLE

See ctmtap.c for ctThrdQueueRead examples.

LIMITATIONS

Can only be used with a ctThrd library.

SEE ALSO

ctThrdQueueClose, ctThrdQueueCount, ctThrdLIFOWrite, ctThrdQueueMlen, ctThrdQueueOpen, and ctThrdQueueWrite.


FairCom Corporation
www.faircom.com