|
| 1 | +--- |
| 2 | +layout: default |
| 3 | +title: TransactionStatus |
| 4 | +type_tag: class |
| 5 | +groups: |
| 6 | + - {name: Home, url: ''} |
| 7 | + - {name: Reference , url: 'reference/'} |
| 8 | + - {name: Domain.h, url: 'reference/Domain.h/'} |
| 9 | +--- |
| 10 | +This class allow to wait for a asynchrounous transactions started with [AsyncTransaction](AsyncTransaction.html). |
| 11 | + |
| 12 | +An instance of `TransactionStatus` shares ownership of its internal state with any transactions it is monitoring. |
| 13 | +The instance itself is a move-only type. |
| 14 | +A single `TransactionState` can monitor multiple transactions and it can be re-used to avoid repeated state allocations. |
| 15 | + |
| 16 | +## Synopsis |
| 17 | +{% highlight C++ %} |
| 18 | +class TransactionStatus |
| 19 | +{ |
| 20 | + // Constructor |
| 21 | + TransactionStatus(); |
| 22 | + TransactionStatus(TransactionStatus&& other); |
| 23 | + |
| 24 | + // Assignemnt |
| 25 | + TransactionStatus& operator=(TransactionStatus&& other); |
| 26 | + |
| 27 | + // Waits until any transactions associated with this instance are done |
| 28 | + void Wait(); |
| 29 | +}; |
| 30 | +{% endhighlight %} |
| 31 | + |
| 32 | +----- |
| 33 | + |
| 34 | +<h1>Constructor <span class="type_tag">member function</span></h1> |
| 35 | + |
| 36 | +## Syntax |
| 37 | +{% highlight C++ %} |
| 38 | +TransactionStatus(); // (1) |
| 39 | +TransactionStatus(TransactionStatus&& other); // (2) |
| 40 | +{% endhighlight %} |
| 41 | + |
| 42 | +## Semantics |
| 43 | +(1) Creates a status instance that does not monitor any transactions. |
| 44 | + |
| 45 | +(2) Creates a status instance by moving internal state from `other` to this. A new state is allocated for `other`. |
| 46 | + |
| 47 | +----- |
| 48 | + |
| 49 | +<h1>operator= <span class="type_tag">member function</span></h1> |
| 50 | + |
| 51 | +## Syntax |
| 52 | +{% highlight C++ %} |
| 53 | +TransactionStatus& operator=(TransactionStatus&& other); |
| 54 | +{% endhighlight %} |
| 55 | + |
| 56 | +## Semantics |
| 57 | +Moves the internal state from `other` to this. Ownership of any previous state is released and a new state is allocated for `other`. |
| 58 | + |
| 59 | +----- |
| 60 | + |
| 61 | +<h1>Wait <span class="type_tag">member function</span></h1> |
| 62 | + |
| 63 | +## Syntax |
| 64 | +{% highlight C++ %} |
| 65 | +void Wait(); |
| 66 | +{% endhighlight %} |
| 67 | + |
| 68 | +## Semantics |
| 69 | +Blocks the current thread until all monitored transactions are done. |
| 70 | +After `Wait` returns, the status instance can be reused. |
0 commit comments