Calling functions within transaction

16 views
Skip to first unread message

Karthik Velayutham

unread,
Apr 1, 2020, 7:32:28 PM4/1/20
to pmem
Hi,

I was wondering how PMDK transactions work with functions being called within a closure? Does the entirety of the function rollback as well during a crash, including persistent memory changes that are made in the method?

Thanks!

Piotr Balcer

unread,
Apr 2, 2020, 6:14:51 AM4/2/20
to pmem
As long as the closure is executed in the same thread as the transaction, yes.

Karthik Velayutham

unread,
Apr 2, 2020, 11:12:13 AM4/2/20
to pmem
Thanks for getting back to me Piotr. My code currently uses the C macro instead of the C++ bindings, so I'm unsure if that makes a difference. I'm talking about something like this: 
TX_BEGIN(pop) {
      do_some_function(arg);
} TX_END

Does the work in do_some_function() rollback as well during a failed transaction? Does your answer apply here too?

Piotr Balcer

unread,
Apr 2, 2020, 11:40:58 AM4/2/20
to pmem
I misunderstood what you meant by closure. Yes, what you are asking about is true. The transaction's state is thread local.
Reply all
Reply to author
Forward
0 new messages