Skip navigation.

ATMI C Function Reference

  Previous Next vertical dots separating previous/next from contents/index/pdf Contents View as PDF   Get Adobe Reader

 


tpsvrinit(3c)

Name

tpsvrinit()—Initializes a BEA Tuxedo system server.

Synopsis

#include <atmi.h> 
int tpsvrinit(int argc, char **argv)

Description

The BEA Tuxedo ATMI system server abstraction calls tpsvrinit() during its initialization. This routine is called after the thread of control has become a server but before it handles any service requests; thus, BEA Tuxedo ATMI system communication may be performed and transactions may be defined in this routine. However, if tpsvrinit() returns with either open connections or asynchronous replies pending, or while still in transaction mode, the BEA Tuxedo ATMI system closes the connections, ignores any pending replies, and aborts the transaction before the server exits.

If an application does not provide this routine in a server, then the default version provided by the BEA Tuxedo ATMI system is called, instead.

If a server has been defined as a single-threaded server, the default tpsvrinit() calls tpsvrthrinit(), and the default version of tpsvrthrinit() calls tx_open(). If a server has been defined as a multithreaded server, tpsvrthrinit() is called in each server dispatch thread, but is not called from tpsvrinit(). Regardless of whether the server is single-threaded or multithreaded, the default version of tpsvrinit() calls userlog() to indicate that the server started successfully.

Application-specific options can be passed into a server and processed in tpsvrinit() (see servopts(5)). The options are passed through argc and argv. Since getopt() is used in a BEA Tuxedo ATMI system server abstraction, optarg(), optind(), and opterr() may be used to control option parsing and error detection in tpsvrinit().

Note: When invoking tpsvrinit() in your code, avoid long blocking actions. Otherwise, when one remote server in an MP configuration has trouble with tpsvrinit() processing, then tmboot fails to boot the other servers on that node.

If an error occurs in tpsvrinit(), the application can cause the server to exit gracefully (and not take any service requests) by returning -1. The application itself should not call exit().

When tpsvrinit() returns -1, the system does not restart the server. Instead, the administrator must run tmboot to restart the server.

Return Values

A negative return value causes the server to exit gracefully.

Usage

When used outside a service routine (for example, in clients, in tpsvrinit(), or in tpsvrdone()), the tpreturn() and tpforward() functions simply return with no effect.

See Also

tpopen(3c), tpsvrdone(3c), tpsvrthrinit(3c), servopts(5)
getopt
(3) in a C language reference manual

 

Skip navigation bar  Back to Top Previous Next