Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main
- {
- /**
- * @param args
- */
- public static void main(String[] args)
- {
- AtomicReference<TValue<Integer>> counter = new AtomicReference<TValue<Integer>>(new TValue<Integer>(0));
- TContext c = new TContext();
- c.priority = 0;
- int i = 0;
- do
- {
- try
- {
- c.txNew();
- c.txWrite(counter, 212);
- i = c.txRead(counter);
- c.txCommit();
- }
- catch (AbortException e)
- {
- if (c.txRethrowAbort())
- {
- throw e;
- }
- }
- } while (!c.txIsCommitted());
- do
- {
- try
- {
- c.txNew();
- c.txWrite(counter, c.txRead(counter) - 1);
- c.txCommit();
- }
- catch (AbortException e)
- {
- if (c.txRethrowAbort())
- {
- throw e;
- }
- }
- } while (!c.txIsCommitted());
- if (i == 212)
- {
- devices.Console.println("Yes");
- }
- else
- {
- devices.Console.println("No");
- }
- }
- }
Add Comment
Please, Sign In to add comment