ct_wakeup

Description

Call a connection’s completion callback.

Syntax

CS_RETCODE ct_wakeup(connection, cmd, function,
                 status)
 
CS_CONNECTION   *connection;
CS_COMMAND        *cmd;
CS_INT                     function;
CS_RETCODE          status;

Parameters

connection

A pointer to the CS_CONNECTION structure whose completion callback will be called. A CS_CONNECTION structure contains information about a particular client/server connection.

Either connection or cmd must be non-NULL.

If connection is supplied, its completion callback is called. If connection is NULL, cmd’s parent connection’s completion callback is called.

If connection is supplied, it is passed as the connection parameter to the completion callback. If connection is NULL, cmd’s parent connection is passed as the connection parameter to the completion callback.

cmd

A pointer to the CS_COMMAND structure managing a client/server operation.

Either connection or cmd must be non-NULL.

If connection is NULL, cmd’s parent connection’s completion callback is called.

cmd is passed as the command parameter to the completion callback. If cmd is NULL then NULL is passed for the command parameter.

function

A symbolic value indicating which routine has completed. function can be a user-defined value. function is passed as the function parameter to the completion callback. Table 3-63 lists the symbolic values that are legal for function:

Table 3-63: Values for ct_wakeup function parameter

Value of function

Meaning

BLK_ROWXFER

blk_rowxfer has completed.

BLK_SENDROW

blk_sendrow has completed.

BLK_SENDTEXT

blk_sendtext has completed.

BLK_TEXTXFER

blk_textxfer has completed

CT_CANCEL

ct_cancel has completed.

CT_CLOSE

ct_close has completed.

CT_CONNECT

ct_connect has completed.

CT_DS_LOOKUP

ct_ds_lookup has completed.

CT_FETCH

ct_fetch has completed.

CT_GET_DATA

ct_get_data has completed.

CT_OPTIONS

ct_options has completed.

CT_RECVPASSTHRU

ct_recvpassthru has completed.

CT_RESULTS

ct_results has completed.

CT_SEND

ct_send has completed.

CT_SEND_DATA

ct_send_data has completed.

CT_SENDPASSTHRU

ct_sendpassthru has completed.

A user-defined value. This value must be greater than or equal to CT_USER_FUNC.

A user-defined function has completed.

status

The return status of the completed routine. This value is passed as the status parameter to the completion callback.

Returns

ct_wakeup returns the following values:

Return value

Meaning

CS_SUCCEED

The routine completed successfully.

CS_FAIL

The routine failed.

CS_BUSY

An asynchronous operation is already pending for this connection. See “Asynchronous programming”.

Examples

Example 1

            ...CODE DELETED.....
            /* Force a wakeup on the connection handle */
             retstat = ct_wakeup(connection, NULL,
                 EX_ASYNC_QUERY, status);
             if (retstat != CS_SUCCEED)
                {
                     return retstat;
                }
               ...CODE DELETED.....

This code excerpt is from the ex_alib.c sample program.

Usage

See also

“Asynchronous programming”, “Callbacks”, ct_callback, ct_poll