|
Zero
0.1.0
|
Used to automatically begin/commit/abort a system transaction. More...
#include <xct.h>
Public Member Functions | |
| sys_xct_section_t (bool single_log_sys_xct=false) | |
| ~sys_xct_section_t () | |
| rc_t | check_error_on_start () const |
| rc_t | end_sys_xct (rc_t result) |
Private Attributes | |
| rc_t | _error_on_start |
| size_t | _original_xct_depth |
Used to automatically begin/commit/abort a system transaction.
Use this class as follows:
rc_t some_function ()
{
// the function to use system transaction
sys_xct_section_t sxs;
W_DO (sxs.check_error_on_start()); // optional: check the system xct successfully started
rc_t result = do_some_thing();
W_DO (sxs.end_sys_xct (result)); //commit or abort, depending on the result code
// if we exit this function without calling end_sys_xct(), the system transaction
// automatically aborts.
return result;
} | sys_xct_section_t::sys_xct_section_t | ( | bool | single_log_sys_xct = false | ) |
starts a nested system transaction.
| [in] | single_log_sys_xct | whether this transaction will have at most one xlog entry |
| sys_xct_section_t::~sys_xct_section_t | ( | ) |
This destructor makes sure the system transaction ended.
|
inline |
Tells if any error happened to begin a system transaction in constructor.
Commits or aborts the system transaction, depending on the given result code.
|
private |
|
private |
1.8.12