atomic transactions function