This PR adds low level support for nested (conditional) transactions.
The idea is that a snapshot of a transaction log can be taken and later the transaction log can be rolled back to discard any changes made after the snapshot was taken. This allows transactions to record tentative changes to locations and then later perform a rollback. This also allows transaction implementations to scope such rollbacks as desired.
Some other STM implementations make such rollbacks implicitly. The reasoning for not making rollbacks implicit is based on the following:
In many cases rollback is unnecessary. For example, Queue.Xt.take_blocking does not logically mutate the queue in case it signals retry and that applies to many similar operations.
In some cases rollback is not only unnecessary, but might also be undesirable as a transaction might record benign changes that "move things forward" without changing the logical state of abstractions. In other words, the scoping of ideal rollback depends on the internals of transactions.
Performing a rollback is potentially linear time O(n) in the number of accessed locations and relatively expensive.
The disadvantage of not making rollbacks implicit is, of course, that it potentially makes the programming model more difficult.
This PR adds low level support for nested (conditional) transactions.
The idea is that a snapshot of a transaction log can be taken and later the transaction log can be rolled back to discard any changes made after the snapshot was taken. This allows transactions to record tentative changes to locations and then later perform a rollback. This also allows transaction implementations to scope such rollbacks as desired.
Some other STM implementations make such rollbacks implicitly. The reasoning for not making rollbacks implicit is based on the following:
Queue.Xt.take_blocking
does not logically mutate the queue in case it signals retry and that applies to many similar operations.O(n)
in the number of accessed locations and relatively expensive.The disadvantage of not making rollbacks implicit is, of course, that it potentially makes the programming model more difficult.