Similar to dbpoll, ct_poll polls connections for asynchronous operation completions and registered procedure notifications.
The main differences between ct_poll and dbpoll are:
ct_poll can take either a CS_CONTEXT or a CS_CONNECTION parameter, while dbpoll takes a DBPROCESS parameter.
ct_poll supports a wider range of completion types (compid).
ct_poll makes the final return code of the completed operation available, while dbpoll does not.
For more detailed information on these differences, see Table 6-4: “Comparing dbpoll and ct_poll”.
If a platform allows the use of callback functions, ct_poll automatically calls the proper callback routine, (if one is installed), when it finds a completed operation or a notification.
Specific restrictions on ct_poll include the following:
ct_poll does not check for asynchronous operation completions if the CS_DISABLE_POLL property is set to CS_TRUE.
If CS_ASYNC_NOTIFS is CS_FALSE, ct_poll will not read from the network to look for registered procedure notifications. Notifications that have already been found while reading command results are still reported. In other words, the application must be actively sending commands and reading results in order for ct_poll to report a registered procedure notification when CS_ASYNC_NOTIFS is CS_FALSE.
dbpoll parameter |
Parameter description |
ct_poll parameter |
Parameter description |
---|---|---|---|
dbproc |
A pointer to a dbprocess structure. If dbproc is NULL, dbpoll checks all open DBPROCESS connections for the arrival of a response. |
context connection (Either context or connection must be NULL) |
Pointers to CS_CONTEXT and CS_CONNECTION structures. If context is NULL, ct_poll checks only a single connection. If connection is NULL, ct_poll checks all open connections within the context. |
milliseconds |
The number of milliseconds that dbpoll should wait for pending operations to complete before returning. If milliseconds is 0, dbpoll will return immediately. If milliseconds is -1, dbpoll will not return until either a server response arrives or a system interrupt occurs. |
milliseconds |
The number of milliseconds that ct_poll should wait for pending operations to complete before returning. If milliseconds is 0, ct_poll will return immediately. If milliseconds is CS_NO_LIMIT, ct_poll will not return until either a server response arrives or a system interrupt occurs. |
ready_dbproc |
A pointer to a pointer to a DBPROCESS structure. dbpoll sets this to point to the DBPROCESS for which the server response has arrived, or to NULL if no response has arrived. |
compconn |
compconn is the address of a pointer variable. If connection is NULL, all connections are polled, and ct_poll sets compconn to point to the CS_CONNECTION structure owning the first completed operation it finds. ct_poll sets compconn to NULL if no operation has completed, or if connection is not NULL. |
compcmd |
compcmd is the address of a pointer variable. ct_poll sets compcmd to point to the CS_COMMAND structure owning the first completed operation it finds. ct_poll sets compcmd to NULL if no operation has completed. |
||
return_reason |
A pointer to a symbolic value indicating why dbpoll returned. |
compid |
A pointer to a symbolic value (CS_SEND, CT_FETCH) indicating what routine has completed. |
(none) |
compstatus |
A pointer to a variable of type CS_RETCODE, which ct_poll sets to indicate the final return code of the completed operation, called the completion status. The completion status can be any of the return codes listed for the routine, except CS_PENDING. |