
here's my implementation of the macros for discussion: https://svn.boost.org/trac/boost/changeset/59760 below are some example use cases. the (unachievable) ideal syntax would be transaction{ //... } for each case. actual syntax: begin_transaction{ //... }end_transaction; in user loops with support for control statements: for(...){ begin_transaction{ if(something) break; }end_transaction_in_loop; } the non-loop variant can be used in user loops if there are no control statements used. user code on retry, for example, limiting the number of retries to 5: int retries=0; begin_transaction{ //... }retry{ if(retries++ == 5) break; }end_retry; the same in a user loop: for(...){ begin_transaction{ if(something) break; }retry{ ... }end_retry_in_loop; } the same can be used for the (RM-specific) case we've discussed before to increase transaction priority on retry: int priority=0; begin_transaction{ stm::set_priority(priority); //... }retry{ ++priority; }end_retry; stm::set_priority() can use transaction_manager::active_transaction() to obtain the transaction. rolling back a transaction on exception: try{ begin_transaction{ //... throw my_exc(); //... }end_transaction; }catch(my_exc &){ //transaction is rolled back } committing the transaction in case of a specific exception: begin_transaction{ try{ //... throw my_exc(); //... }catch(my_exc &){ //tx will commit if my_exc is not rethrown } }end_transaction; invalid use cases: using in_loop outside of user loops: begin_transaction{ }end_transaction_in_loop; //compiler error: illegal "break" using control statements without in_loop: for(...){ begin_transaction{ if(something) break; }end_transaction; //error } this raises a runtime assertion if something==true. ideal would be a compiler error, but I don't think that is possible. are there any additional use cases to consider? comments on syntax? regards, Stefan