This class allow to wait for a asynchrounous transactions started with AsyncTransaction.
An instance of TransactionStatus
shares ownership of its internal state with any transactions it is monitoring.
The instance itself is a move-only type, i.e. each transaction status manages a unique state.
A single TransactionState
can monitor multiple transactions and it can be re-used to avoid repeated state allocations.
class TransactionStatus
{
// Constructor
TransactionStatus();
TransactionStatus(TransactionStatus&& other); // Move
// Assignemnt
TransactionStatus& operator=(TransactionStatus&& other); // Move
// Waits until any transactions associated with this instance are done
void Wait();
};
TransactionStatus(); // (1)
TransactionStatus(TransactionStatus&& other); // (2)
(1) Creates a status instance that does not monitor any transactions.
(2) Creates a status instance by moving internal state from other
to this. A new state is allocated for other
.
TransactionStatus& operator=(TransactionStatus&& other);
Moves the internal state from other
to this. Ownership of any previous state is released and a new state is allocated for other
.
void Wait();
Blocks the current thread until all monitored transactions are done.
After Wait
returns, the status instance can be reused.