Skip navigation.

ATMI C Function Reference

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

 


tpsblktime(3c)

Name

tpsblktime() —Routine for setting blocktime in seconds for the next service call or for all service calls

Synopsis

#include <atmi.h>  
int tpsblktime(int blktime,long flags)

Description

tpsblktime() is used to set the blocktime value, in seconds, of a potential blocking API. A potential blocking API is defined as: any system API that can use the flag TBNOBLOCK as a value. It does not have any effect on transaction timeout values.

The blktime range is 0 to 32767. Effective blocktime values are rounded up to the nearest multiple of the SCANUNIT value as depicted in the following example:

User Set Blocktime Value

Scanunit Value

Effective Blocktime Value

13

5

15

18

5

20


 

A 0 value indicates that any previously set blocking time flag value is cancelled, and the blocking time set with a different blocktime flag value prevails. If tpsblktime() is not called, the BLOCKTIME value in the *SERVICES section or the default *RESOURCES section of the UBBCONFIG file is used.

Note: Blocking timeouts set with tpsblktime() take precedence over the BLOCKTIME parameter set in the SERVICES and RESOURCES section of the UBBCONFIG file. The precedence for blocktime checking is as follows:
tpsblktime(TPBLK_NEXT), tpsblktime(TPBLK_ALL), *SERVICES, *RESOURCES

The following is a list of valid flags:

TPBLK_NEXT

This flag sets the blocktime value, in seconds, for the next potential blocking API.
Any API that is called containing the TPNOBLOCK flag is not effected by tpsblktime (TPBLK_NEXT)and continues to be non-blocking.

A TPBLK_NEXT flag value overrides a TPBLK_ALL flag value for those API calls that immediately follow it. For example:

tpsblktime(50,TPBLK_ALL)
tpcall(one)
tpsblktime(30,TPBLK_NEXT)
tpcall(two)
tpcall(three)

tpcall(two) will have a 30 second blocking timeout based on tpsblktime(30,TPBLK_NEXT). tpcall(one) and tpcall(three) will have a 50 second blocking timeout based on tpsblktime(50,TPBLK_ALL).

tpsblktime(TPBLK_NEXT) operates on a per-thread basis. Therefore, it is not necessary for applications to use any mutex around the tpsblktime(TPBLK_NEXT)call and the subsequent API call which it affects.

TPBLK_ALL

This flag sets the blocktime value, in seconds, for the all subsequent potential blocking APIs until the next tpsblktime() is called within that context. Any API that is called containing the TPNOBLOCK flag is not effected by tpsblktime(TPBLK_ALL) and continues to be non-blocking.

tpsblktime(TPBLK_ALL) operates on a per-context basis. Therefore, it is necessary to call tpsblktime(TPBLK_ALL) in only one thread of context that is used in multiple threads.

tpsblktime(TPBLK_ALL)will not affect any context that follows after tpterm(3c) is called.

Note: In order to perform blocking time values that are not affected by thread timing dependencies, it is best that tpsblktime(TPBLK_ALL) is called in a multi-threaded context immediately after tpinit(3c) using the TPMULTICONTEXTS flag and before the return value of tpgetctxt(3c) is made available to other threads.

When tpsblktime(TPBLK_ALL) is called in a service on a multi-threaded server, it will affect the currently executed thread only. To set the blocktime for all services, it is best to use tpsblktime(TPBLK_ALL) with tpsvrinit(3c) or tpsvrthrinit(3c).

Return Values

tpsblktime()returns -1 on error and sets tperrno to indicate the error condition.

Error

Upon failure, tpsblktime() sets tperrno to one of the following values:

[TPEINVAL]

Invalid arguments were given. For example, the value of blktime is negative or more than one TPBLK_NEXT and TPBLK_ALL blocktime flag value is specified.

[TPERELEASE]

tpsblktime() was called in a client attached to a workstation handler running an earlier Tuxedo release.

[TPESYSTEM]

A BEA Tuxedo system error has occurred. The exact nature of the error is written to a log file.

See Also

tpcall(3c), tpcommit(3c), tprecv(3c), tpgblktime(3c), UBBCONFIG(5)

 

Skip navigation bar  Back to Top Previous Next