Lock a routine instance to a VP
If your UDR allocates resources that are process specific, it needs to be locked onto the VP where it started execution.
- Restrict execution of the UDR to a single-instance VP class.
By executing in a single-instance VP, a UDR can be guaranteed that all invocations and instances execute in the same VP. Therefore, all UDRs can access global information of the process. (For more information, see Avoid modification of global and static variables.) However, a single-instance VP class does have significant impact on performance and parallel scalability.
- Lock the UDR to a VP with the mi_udr_lock() function.
When you call mi_udr_lock() with an argument of MI_TRUE, you set the VP lock flag to prevent this instance of the UDR from migrating to another VP. Therefore, the UDR instance always executes on the VP where it is running. However, an MI_TRUE VP lock flag does not prevent another instance of the UDR from executing on a different VP.