Skip navigation.

ATMI C Function Reference

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

 


tpsvrthrinit(3c)

Name

tpsvrthrinit()—Initializes a BEA Tuxedo ATMI server thread.

Synopsis

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

Description

The BEA Tuxedo ATMI 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 ATMI server but before the thread handles any service requests. Thus, BEA Tuxedo ATMI 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 ATMI 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 ATMI 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 ATMI 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

 

Skip navigation bar  Back to Top Previous Next