return txn->status;
}
+/* Attempts to commit 'txn', blocking until the commit either succeeds or
+ * fails. Returns the final commit status, which may be any TXN_* value other
+ * than TXN_INCOMPLETE. */
+enum ovsdb_idl_txn_status
+ovsdb_idl_txn_commit_block(struct ovsdb_idl_txn *txn)
+{
+ enum ovsdb_idl_txn_status status;
+
+ while ((status = ovsdb_idl_txn_commit(txn)) == TXN_INCOMPLETE) {
+ ovsdb_idl_run(txn->idl);
+ ovsdb_idl_wait(txn->idl);
+ ovsdb_idl_txn_wait(txn);
+ poll_block();
+ }
+ return status;
+}
+
int64_t
ovsdb_idl_txn_get_increment_new_value(const struct ovsdb_idl_txn *txn)
{
void ovsdb_idl_txn_destroy(struct ovsdb_idl_txn *);
void ovsdb_idl_txn_wait(const struct ovsdb_idl_txn *);
enum ovsdb_idl_txn_status ovsdb_idl_txn_commit(struct ovsdb_idl_txn *);
+enum ovsdb_idl_txn_status ovsdb_idl_txn_commit_block(struct ovsdb_idl_txn *);
void ovsdb_idl_txn_abort(struct ovsdb_idl_txn *);
const char *ovsdb_idl_txn_get_error(const struct ovsdb_idl_txn *);
}
}
- while ((status = ovsdb_idl_txn_commit(txn)) == TXN_INCOMPLETE) {
- ovsdb_idl_run(idl);
- ovsdb_idl_wait(idl);
- ovsdb_idl_txn_wait(txn);
- poll_block();
- }
+ status = ovsdb_idl_txn_commit_block(txn);
printf("%03d: commit, status=%s",
step, ovsdb_idl_txn_status_to_string(status));
if (increment) {
vsctl_context_done(&ctx, c);
}
- while ((status = ovsdb_idl_txn_commit(txn)) == TXN_INCOMPLETE) {
- ovsdb_idl_run(idl);
- ovsdb_idl_wait(idl);
- ovsdb_idl_txn_wait(txn);
- poll_block();
- }
+ status = ovsdb_idl_txn_commit_block(txn);
if (wait_for_reload && status == TXN_SUCCESS) {
next_cfg = ovsdb_idl_txn_get_increment_new_value(txn);
}
poll_timer_wait(prune_timeout);
}
- while ((status = ovsdb_idl_txn_commit(txn)) == TXN_INCOMPLETE) {
- ovsdb_idl_run(idl);
- ovsdb_idl_wait(idl);
- ovsdb_idl_txn_wait(txn);
- poll_block();
- }
+ status = ovsdb_idl_txn_commit_block(txn);
switch (status) {
case TXN_INCOMPLETE: