What happens when you create nested dosin calls? Will the sub-transaction be completed in the field of parents? Are these sub-transactions reversible if the original transaction fails?
If you mean syntax nests, then answer depends on this Internal dosync
will run externally on the same thread .
In the closure, whenever a dosync
block is entered, a new transaction is initiated if no one is already running on this thread This means that when the execution remains on a thread, the internal transaction can be said to be contained by external transactions; However, if someone is located in the syntax of a code other than dosync
, dosync , but can be launched on a new thread, then it will have a new transaction.
An example (expected) indicates what happens:
User & gt; (Def R (Ref 0)) # 'User / R User & gt; (Dosnek (future (Dosic (Thread / Sleep 50) (Princeton: EFU) (RAR REC) (printline: bar) (RAR REC)): Bar: AF: FU1 user & gt; @ R2
After the printing "Inner" tries to retry the transaction : foo
; "external" transaction does not need to be restarted (note that this happens After, the history series of r
has increased, so if the "big" dosync
form was evaluated for the second time, then Rick dosync
will not try again. It still does not merge into the external one.)
Incidentally, Mark Volckman has written a great article on the closure; < / P>
Comments
Post a Comment