$TR[ESTART] contains a count of the number of times the current TRANSACTION has been RESTARTed. A RESTART can be explicit (specified in M as a TRESTART) or implicit (initiated by GT.M as part of its internal concurrency control mechanism). When there is no TRANSACTION in progress, $TRESTART is zero (0).
$TRESTART can be used by the application to limit the number of RESTARTs, or to cause a routine to perform different actions during a RESTART than during the initial execution.
![]() |
|
GT.M does not permit the SET command to modify $TRESTART. |
Example:
TRANS TSTART ():SERIAL IF $TRESTART>2 WRITE !;"Access Conflict" QUIT
This example terminates the sub-routine with a message if the number of RESTARTs exceeds 2.
For more information on transaction processing, refer to the section on that topic in the "General Language Features of M".