OpenTP1 Version 7 Programming Guide

[Contents][Index][Back][Next]

4.6.6 Lock migration

If lock is specified for a resource by using the function dc_lck_get(), the resource lock right is transferred sequentially from one transaction branch to another in a global transaction. This facility is called lock migration. Lock migration prevents a deadlock or lock wait between transaction branches. Therefore, once lock is specified for a resource in a global transaction, the resource can be accessed from any transaction branch in the global transaction as long as the specification is in effect.

Lock migration is ensured in the following cases:

Organization of this subsection
(1) Lock migration and lock modes
(2) Releasing resources with lock migration specified
(3) Notes on lock migration

(1) Lock migration and lock modes

With lock migration, if the EX mode is specified in another transaction branch after lock has been specified in PR mode, all the subsequent lock is in EX mode. In a global transaction, once resources are put under lock in EX mode, the resource cannot be put under lock in PR mode. All resources are under lock in EX mode.

(2) Releasing resources with lock migration specified

If resources are under lock with lock migration specified, they are automatically released when the global transaction terminates. If the resources can be released before the termination of the global transaction, take the following procedures:

(3) Notes on lock migration

Do not access a resource for which lock has been specified (access to an already allocated resource or a new lock request) in the following case:

The figure below shows lock migration.

Figure 4-23 Outline of lock migration

[Figure]