Back to home page

Enduro/X

 
 

    


0001 TPSVRTHRINIT(3)
0002 ===============
0003 :doctype: manpage
0004 
0005 
0006 NAME
0007 ----
0008 tpsvrthrinit - Template and default version for server dispatch thread init function
0009 
0010 
0011 SYNOPSIS
0012 --------
0013 #include <atmi.h>
0014 
0015 int tpsvrthrinit (int 'argc', char **'argv');
0016 
0017 For XATMI server link with '-latmisrvinteg -latmi -lubf -lnstd -lpthread -lrt -lm'
0018 
0019 DESCRIPTION
0020 -----------
0021 This function is called upon XATMI server process starting up. Function is invoked
0022 for XATMI servers which are configured to work in multi-threaded mode.
0023 
0024 The 'argc' and 'argv' is command line parameters  passed to binary after the '--'. 
0025 Initial parameters are used by Enduro/X, these are sys-opts in the *ndrxconfig.xml*, 
0026 after the '--' those are application specific options.
0027 
0028 Normally at *tpsvrthrinit()* is used for threads to perform the initialization.
0029 In multi-threaded mode, the worker threads actually are clients for which *tpinit()*
0030 is done previously by Enduro/X.
0031 
0032 The default version of this function is provided by Enduro/X which is built in
0033 in the the *-latmisrvinteg* library. Default version of the function invokes
0034 *tx_open()*. If *tx_open()* fails, the service process will abort the startup.
0035 
0036 The *tpsvrthrinit()* is activated only
0037 
0038 . if XATMI server is built by *builserver(8)* having flag *-t* set.
0039 
0040 . Or XATMI server process is started by *_tmstartserver(3)* with extern variable 
0041 *_tmbuilt_with_thread_option* is set to *1*. And function name is specified in 
0042 *tmsvrargs_t* structure for the *p_tpsvrthrinit* field.
0043 
0044 In case if program is single threaded and default *tpsrvinit(3)* is used. Where
0045 default *tpsrvinit()* will invoke the *tpsvrthrinit()*.
0046 
0047 To start program as multi-threaded *ndrxconfig.xml(5)* in server section 
0048 *<mindispatchthreads>* and *<maxdispatchthreads>* must be greater than 1.
0049 
0050 
0051 This only applies to XATMI servers.
0052 
0053 In case if using C++ compiler, function must be defined without name mangling,
0054 thus extern "C" prefix shall be used.
0055 
0056 RETURN VALUE
0057 ------------
0058 If application failed to initialize, the user shall return non 0 value. 
0059 If succeed, then 0 must be returned.
0060 
0061 ERRORS
0062 ------
0063 Not available.
0064 
0065 EXAMPLE
0066 -------
0067 See *atmitest/test075_dispthread/atmisv75.c* for sample code.
0068 
0069 BUGS
0070 ----
0071 Report bugs to support@mavimax.com
0072 
0073 SEE ALSO
0074 --------
0075 *tpsvrinit(3)* *tpsvrdone(3)* *tpsvrthrdone(3)* 
0076 *_tmstartserver(3)* *ndrxconfig.xml(5)* *buildserver(8)*
0077 
0078 COPYING
0079 -------
0080 (C) Mavimax, Ltd
0081