srv_reginit

Description

Begin executing a registered procedure.

Syntax

CS_RETCODE srv_reginit(spp, procnamep,
                     namelen, options)
SRV_PROC          *spp;
CS_CHAR            *procnamep;
CS_INT                 namelen;
unsigned short      options;

Parameters

spp

A pointer to an internal thread control structure.

procnamep

A pointer to the name of the registered procedure.

namelen

The length of the procedure name. If the name is null terminated, namelen can be CS_NULLTERM.

options

A flag that determines which threads to notify. Table 3-96 describes the legal values for options:

Table 3-96: Values for options (srv_reginit)

Value

Description

SRV_M_PNOTIFYALL

Notify all waiting threads in the notification list.

SRV_M_PNOTIFYNEXT

Notify only the thread that has been waiting the longest.

Returns

Table 3-97: Return values (srv_reginit)

Returns

To indicate

CS_SUCCEED

The routine completed successfully.

CS_FAIL

The routine failed.

Examples

Example 1

#include    <ospublic.h>
/*
** Local Prototype.
*/
CS_RETCODE     ex_srv_reginit  PROTOTYPE((
SRV_PROC       *sp,
CS_CHAR        *pname,
CS_INT         nlen
));

/*
** EX_SRV_REGINIT
**
**    This routine demonstrates how to use srv_reginit to
**    initiate the execution of a registered procedure.
**
** Arguments:
**         sp       A pointer to an internal thread control 
                    structure.
**         pname    The name of the procedure to execute.
**         nlen     The length of the procedure name.
** Returns
**
**    CS_SUCCEED    If the registered procedure began execution.
**    CS_FAIL       If an error was detected.
**
*/
CS_RETCODE      ex_srv_reginit(sp, pname, nlen)
SRV_PROC        *sp;
CS_CHAR         *pname;
CS_INT          nlen;
{
      /*
      ** Call srv_reginit to initiate the execution of this
      ** registered procedure; ask that all threads waiting for
      ** notification of this event be notified.
      */
      if( srv_reginit(sp, pname, nlen, SRV_M_PNOTIFYALL) ==
            CS_FAIL )
      {
           /*
           ** An error was al&ready raised.
           */
           return CS_FAIL;
      }

      /*
      ** All done.
      */
      return CS_SUCCEED;
}

Usage

See also

srv_regexec, srv_regparam