Question about thread safe

26 views
Skip to first unread message

Xin Zhang

unread,
Oct 4, 2017, 2:05:53 PM10/4/17
to pmem
If I use transaction::exec_tx, do I have a concurrent issue? For example, two threads hold the same pool pointer and both want to open a pool or write a data into pool with transaction::exec_tx. In this scenario, do I have a concurrent issue?

Additional, If two threads write the different data into two different slots(offsets), but in the same pool, it has a concurrent issue?

Thanks

Marcin Ślusarz

unread,
Oct 4, 2017, 4:02:50 PM10/4/17
to Xin Zhang, pmem
Pmemobj API in general is thread-safe. There are few exceptions (open, create,
close, root and some ctl options), but normal applications should use them only
during startup and shutdown.

Of course if you want to modify the same piece of memory from multiple
threads you have to do the locking yourself.

I recommend looking at pmemobj documentation.
Both man page [1] and tutorial [2] address thread safety.

Marcin

[1] http://pmem.io/nvml/manpages/linux/master/libpmemobj.3.html
[2] http://pmem.io/2015/06/18/threads.html
Reply all
Reply to author
Forward
0 new messages