OpenTP1 Version 7 Programming Reference C Language

[Contents][Index][Back][Next]

dc_rpc_set_service_prio - Set a schedule priority of a service request

Format

ANSI C, C++

#include <dcrpc.h>
void dc_rpc_set_service_prio (DCLONG prio)

K&R C

#include <dcrpc.h>
void dc_rpc_set_service_prio (prio)
DCLONG      prio;

Description

The function dc_rpc_set_service_prio() sets a priority of a service request. It is called when controlling schedule priorities for individual service requests. The priority set by this function remains unchanged until it is updated by the same function. Therefore, if service requests are to be called at once with the same priority, call this function only once.

The priority set by this function will be reported to the server via the schedule queue by the function dc_rpc_call() which is called immediately after this function.

If this function is not called at all, the value 4, which is the default interpretation of the schedule service, is set as the priority of service requests.

Arguments whose value is set in the UAP

prio

Specify the schedule priority of the service request in the range from 0 to 8. This argument must always be set.

The highest priority is represented by 1 and the lowest priority is represented by 8. If 0 is specified, the default interpretation of the schedule service will be in effect.

If a value other than the above is specified, the function dc_rpc_set_service_prio() is ignored.

Return values

There is no return value of the function dc_rpc_set_service_prio().

Notes

  1. The priority specified for the service request is valid on a queue-receiving server only when service_priority_control=Y (priority control in effect) is specified in the user service definition for the server UAP. If the server UAP to which the service request is addressed does not control priorities, this function is invalid even if called.
  2. The function dc_rpc_set_service_prio() is invalid if it is called for a service request represented by the function dc_rpc_call() of the second or subsequent chained RPC or by the function dc_rpc_call() (DCNOFLAGS specified for flags) of synchronous-response-type RPC called to terminate the RPC chain.
  3. The function dc_rpc_call() does not reset the service request priority to the default value. To reset the service request priority, recall the function dc_rpc_set_service_prio() with 0 specified for the argument prio.

Example

int     rc;
DCULONG in_len, len;
char    *buf;
/*  First service request:
 *  No priority is set (default interpretation of schedule service in effect)
 */
rc = dc_rpc_call("SPPG", "ECHO", "exl", &in_len, buf, &len, DCNOFLAGS);
/*  Second service request: Priority = 8
 */
dc_rpc_set_service_prio(8);
rc = dc_rpc_call("SPPG", "ECHO", "ex2", &in_len, buf, &len, DCNOFLAGS);
/*  Third service request (chained RPC): Priority = 1
 */
dc_rpc_set_service_prio(1);
rc = dc_rpc_call("SPPG", "ECHO", "ex3", &in_len, buf, &len, DCRPC_CHINED);
      :
 (Chained RPC dc_rpc_call(DCRPC_CHAINED) repeated n times)
      :
rc = dc_rpc_call("SPPG", "ECHO", "ex3", &in_len, buf, &len,
                 DCNOFLAGS);
/*  (4 + n + 1)-th or subsequent service request:
 * Priority is reset (to default interpretation of schedule service)
 */
dc_rpc_set_service_prio(0);
rc = dc_rpc_call("SPPG", "ECHO", "ex4", &in_len, buf, &len, DCRPC_NOREPLY);