srv_createproc

Description

Create a non-client, event-driven thread.

Syntax

SRV_PROC         *srv_createproc(ssp)
SRV_SERVER     *ssp;

Parameters

ssp

A pointer to the Open Server state information control structure.

Returns

If successful, srv_createproc returns a pointer to the new thread control structure. If unsuccessful, srv_createproc returns a NULL thread pointer, and Open Server raises an error.

Table 3-26: Return values (srv_createproc)

Returns

To indicate

A pointer to the new thread control structure

Open Server created the thread.

A null thread pointer

Open Server could not create the thread.

Open Server raises an error.

Examples

Example 1

#include          <ospublic.h>
/*
 ** Local Prototype
 */
CS_RETCODE               ex_srv_creatp     PROTOTYPE((
SRV_SERVER               *ssp,
SRV_PROC                 *newsp
));
/*
** EX_SRV_CREATP
**     Example routine to create a non-client, event driven 
 **     thread.
**
** Arguments:
**
**     ssp     A pointer to the Open Server state information
 **             control structure.
**    newsp    A pointer that will be returned by srv_createproc
 **             and point to the new thread control structure.
**
** Returns
**
**     CS_SUCCEED            Thread was created.
**     CS_FAIL               An error was detected.
**
 */
CS_RETCODE             ex_srv_creatp(ssp, newsp)
SRV_SERVER             *ssp;
SRV_PROC               *newsp;
{
     /* Check arguments. */
     if(ssp == (SRV_SERVER *)0)
          return(CS_FAIL);

     /*
     ** Create the new thread
     */
     newsp = srv_createproc(ssp);
     if(newsp == (SRV_PROC *)NULL)
          return(CS_FAIL);
     return(CS_SUCCEED);
}

Usage

See also

srv_event,srv_event_deferred, srv_spawn, srv_termproc, srv_thread_props