HomeReferenceDomain.h ⇀ DoTransaction

DoTransaction function

Executes given function as transaction in the current thread.

Syntax

// (1)
template
<
    typename D,
    typename F
>
void DoTransaction(F&& func);

// (2)
template
<
    typename D,
    typename F
>
void DoTransaction(TransactionFlags flags, F&& func);

Semantics

Runs func in transaction mode. During transaction mode, all reactive inputs are collected and propagated in a single turn after func returns.

The purpose of this is

(1) uses the default turn flags for the transaction. (2) allows to set flags explicitly. Valid flag masks result from bitwise disjunction of

Flags are a bitmask of type

using TransactionFlagsT = underlying_type<ETransactionFlags>::type;

It can be created by Bitwise Or of

enum ETransactionFlags
{
    allow_merging
};

allow_merging allows merging of multiple transactions into a single turn to improve performance. This can happen when N successively mergeable transactions are waiting to gain exclusive access to the graph. Further, this is only the case for domains that support concurrent input.

The implications are that

If these conditions are acceptable, merging can improve concurrent throughput, because

Merging happens independently of whether transactions are synchronous or asynchrounous. Except for the aforementioned implications, it has no further observable effects, in particular w.r.t. to TransactionStatus or continuations.