Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

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 (638). If no message is available to be read within the interval specified in milliseconds by the timeout parameter, ctThrdQueueRead() returns NTIM_ERR (156). 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 FairCom DB Error Codes for a complete listing of valid FairCom DB 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, ctThrdQueueWrite

TOCIndex