Ejemplo n.º 1
0
 /// <summary>
 /// The action is performed just before commit, and reads the latest
 /// data. If it conflicts, only it is retried. If it succeeds,
 /// we (try to) commit with the same write stamp along with it.
 /// But, if you access this Shielded, it gets executed directly in this transaction.
 /// The Changed event is raised only when the commute is enlisted, and not
 /// when (and every time, given possible repetitions..) it executes.
 /// </summary>
 public void Commute(ModificationDelegate perform)
 {
     Shield.EnlistStrictCommute(
         () => perform(ref PrepareForWriting(true).Value), this);
     RaiseChanged();
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Modifies the content of the field, i.e. read and write operation.
 /// It has the advantage of working directly on the internal, thread-local
 /// storage copy, to which it gets a reference. This is more efficient if
 /// the type T is a big value-type.
 /// </summary>
 public void Modify(ModificationDelegate d)
 {
     d(ref PrepareForWriting(true).Value);
     RaiseChanged();
 }