Method Post
- Namespace
- SodaFlow
- Assembly
- SodaFlow.dll
Post(Action)
Runs an action after the current transaction closes or immediately if there is no current transaction.
public static void Post(Action action)
Parameters
actionActionThe action to run after the current transaction closes or immediately if there is no current transaction.
Remarks
A transaction that fails while it propagates does not run the actions that this method holds. A listener that throws is one cause of such a failure. Thus, an action here is not a promise that this library keeps in each condition. An action can give a value to code that waits. A TaskCompletionSource, or a callback of a different library, is such code. Use Post(Action, Action<Exception>) for that action, and release the waiting code there.
Post(Action, Action<Exception>)
Runs an action after the current transaction closes, or immediately if
there is no current transaction. Runs onFailure where
that action does not run or does not complete.
public static void Post(Action action, Action<Exception> onFailure)
Parameters
actionActionThe action to run after the current transaction closes or immediately if there is no current transaction.
onFailureAction<Exception>The action to run where
actiondoes not complete, with the exception that is the cause.
Remarks
Use this where action gives a value to code that waits,
such as a TaskCompletionSource or a callback of a different library. A
transaction that fails while it propagates does not run the actions that
Post holds, and that code then waits forever. onFailure
is where the caller releases it.
onFailure runs one time, and only where
action does not complete. Two conditions give that:
the transaction fails before it runs the action, and the action itself
throws. The argument is the exception of the transaction in the first
condition, and the exception of the action in the second. An action
that completes runs no release.
A throw from onFailure does not replace the
exception that caused it. The caller gets an AggregateException with
that exception first, and the throw from the release after it.