| 46 | } |
| 47 | |
| 48 | void wf::txn::transaction_t::commit() |
| 49 | { |
| 50 | LOGC(TXN, "Committing transaction ", this, " with timeout ", this->timeout); |
| 51 | if (this->objects.empty()) |
| 52 | { |
| 53 | // Empty transaction, directly ready. |
| 54 | apply(false); |
| 55 | return; |
| 56 | } |
| 57 | |
| 58 | for (auto& obj : this->objects) |
| 59 | { |
| 60 | obj->connect(&on_object_ready); |
| 61 | obj->commit(); |
| 62 | } |
| 63 | |
| 64 | timer_setter(this->timeout, [=] () |
| 65 | { |
| 66 | if (count_ready_objects < (int)this->objects.size()) |
| 67 | { |
| 68 | apply(true); |
| 69 | } |
| 70 | |
| 71 | return false; |
| 72 | }); |
| 73 | } |
| 74 | |
| 75 | void wf::txn::transaction_t::apply(bool did_timeout) |
| 76 | { |