BEA Logo BEA Tuxedo Release 7.1

  Corporate Info  |  News  |  Solutions  |  Products  |  Partners  |  Services  |  Events  |  Download  |  How To Buy

 

   Tuxedo Doc Home   |   Reference   |   Topic List   |   Previous   |   Next   |   Contents

   BEA Tuxedo C Function Reference

tpsvrthrinit(3c)

Name

tpsvrthrinit() - initializes a BEA Tuxedo server thread

Synopsis

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

Description

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

If an application does not provide this routine in a server, then the default version of tpsvrthrinit() provided by the BEA Tuxedo system is called instead. The default version of tpsvrthrinit() calls tx_open().

tpsvrthrinit() is called even in single-threaded servers. In a single-threaded server, tpsvrthrinit() is called from the default version of tpsvrinit(). In a server with the potential for multiple dispatch threads, tpsvrinit() does not call tpsvrthrinit().

Application-specific options can be passed into a server and processed in tpsvrthrinit(). For more information about options, see servopts(5). The options are passed argc and argv. Because getopt() is used in a BEA Tuxedo server abstraction, optarg(), optind(), and opterr() may be used to control option parsing and error detection in tpsvrthrinit().

If an error occurs in tpsvrthrinit(), the application can cause the server dispatch thread to exit gracefully (and not take any service requests) by returning -1. The application should not call exit() or any operating system thread exit function.

Return Values

A negative return value will cause the server dispatch thread to exit gracefully.

Usage

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

See Also

tpforward(3c), tpreturn(3c), tpsvrthrdone(3c), tpsvrthrinit(3c), tx_open(3c), servopts(5)

getopt(3) in a C language reference manual