
On Thu, 25 Mar 2010 18:16:07 +0100, you wrote:
Yes counting the nesting level like Twan proposed will definitely solve the modularity problem.
I do think we need to optimize the block and unblock operations in such a way that they don't need to use IORefs to save the counting level. The version Twan posted requires 2 reads and 2 writes for a block and unblock. While I haven't profiled it I think it's not very efficient.
Wouldn't you be better off using "real" transaction processing (i.e., with rollback)? That preserves the greatest possible modularity, because the lower level operations don't have to worry about failures at all. You generally only care about atomicity at some outer, "observable" level; there is rarely any point in worrying about "nested atomicity." Steve Schafer