![]() |
![]() |
|
|
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().
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().
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
![]() |
![]() |
![]() |
|
Copyright © 2001 BEA Systems, Inc. All rights reserved.
|