Create a non-client, event-driven thread.
SRV_PROC *srv_createproc(ssp)
SRV_SERVER *ssp;
A pointer to the Open Server state information control structure.
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.
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. |
#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);
}
srv_createproc creates a thread that is driven by programmer-defined events raised by srv_event or srv_event_deferred.
Non-client threads receive only programmer-defined events. They never receive client-generated events.
Use srv_termproc to terminate a thread created with srv_createproc.
Non-client threads have no client I/O. Calling srv_thread_props with the property argument set to (SRV_T_IODEAD) always returns CS_FALSE for a non-client thread.
srv_event,srv_event_deferred, srv_spawn, srv_termproc, srv_thread_props