Home | Previous Page | Next Page   Creating User-Defined Routines > Writing a User-Defined Routine >

Controlling the VP Environment

The routine manager executes your C UDR in a virtual-processor (VP) environment. The VP environment consists of a VP and VP class, as follows:

The following traits of C UDRs are common reasons for needing to control the VP environment:

Warning:
The ability of the database server to support some C++ features should not be taken as an open invitation to freely use C++ in your UDR code. Many C++ features implicitly violate the Safe-Coding Requirements for a well-behaved routine (see Table 85). Problems can arise if some C++ features are used in a UDR.

If the source code is not available to change the UDR so that it is well-behaved, the only solution is to isolate the code execution from the CPU VP class. Possible execution scenarios include executing:

The DataBlade API provides the following functions to enable UDRs and DataBlade modules to examine their VP environment and to control portions thereof.

VP-Environment Information DataBlade API Function
Obtain information about the current VP environment from within a UDR mi_vpinfo_classid( ),
mi_vpinfo_isnoyield( ),
mi_vpinfo_vpid( )
mi_class_id( )
,
mi_class_maxvps( ),
mi_class_name( ),
mi_class_numvp( )
Lock the UDR to a VP environment mi_module_lock( ),
mi_udr_lock( )
Change the VP environment in which a UDR executes mi_call_on_vp( ),
mi_process_exec( )

Warning:
These advanced functions can adversely affect your UDR if you use them incorrectly. Use them only when no regular DataBlade API functions can perform the tasks you need done.
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]