PMDK C++ bindings
1.7
This is the C++ bindings documentation for PMDK's libpmemobj.
|
C++ manual scope transaction class. More...
#include <libpmemobj++/transaction.hpp>
Public Member Functions | |
template<typename... L> | |
manual (obj::pool_base &pop, L &... locks) | |
RAII constructor with pmem resident locks. More... | |
~manual () noexcept | |
Destructor. More... | |
manual (const manual &p)=delete | |
Deleted copy constructor. | |
manual (const manual &&p)=delete | |
Deleted move constructor. | |
manual & | operator= (const manual &p)=delete |
Deleted assignment operator. | |
manual & | operator= (manual &&p)=delete |
Deleted move assignment operator. | |
C++ manual scope transaction class.
This class is one of pmemobj transaction handlers. All operations between creating and destroying the transaction object are treated as performed in a transaction block and can be rolled back. The manual transaction has to be committed explicitly otherwise it will abort.
The locks are held for the entire duration of the transaction. They are released at the end of the scope, so within the catch
block, they are already unlocked. If the cleanup action requires access to data within a critical section, the locks have to be manually acquired once again.
The typical usage example would be:
|
inline |
RAII constructor with pmem resident locks.
Start pmemobj transaction and add list of locks to new transaction. The list of locks may be empty.
[in,out] | pop | pool object. |
[in,out] | locks | locks of obj::mutex or obj::shared_mutex type. |
pmem::transaction_error | when pmemobj_tx_begin function or locks adding failed. |
|
inlinenoexcept |
Destructor.
End pmemobj transaction. If the transaction has not been committed before object destruction, an abort will be issued.