10.2.6 How Multithreading and Multicontexting Work in Application-Created Threads of an ATMI Server

Using your operating system functions, you may create additional threads within a Tuxedo application server. Initially, application-created server threads are not associated with any Tuxedo context. Application-created threads may:

  • Operate independently of the Tuxedo system.
  • Operate in the context created by tpappthrinit(3c). (This feature is available from Tuxedo 11g Release 1 (11.1.1.3.0)).
  • Operate in the same context as an existing server-dispatched thread and work on behalf of server-dispatched contexts.

    In this situation, the application-created server thread may call tpsetctxt(3c) (and pass it a value returned by a previous call to tpgetctxt(3c) within a server-dispatched thread) to associate itself with that server-dispatched context.

    When an application-created server thread associated with a server-dispatched context has finished its work, it must call tpsetctxt(3c) to set to TPNULLCONTEXT before the originally dispatched thread calls tpreturn().

  • An application-created thread cannot call tpreturn() or tpforward().

An application-created server thread may create a separate Tuxedo context and associate itself with this context using tpappthrinit(3c). The life cycle of a Tuxedo context created by tpappthrinit(3c) when an application-created server thread is active can be described in three phases: