1. #define TIMES 10
  2. byte cnt = 0;
  3. byte barrier = 0;
  4. proctype counting()
  5. {
  6. byte i = 1;
  7. byte tmp;
  8. do
  9. ::(i > TIMES) -> break
  10. ::else ->
  11. tmp = cnt;
  12. tmp = tmp + 1;
  13. cnt = tmp;
  14. i++
  15. od;
  16. barrier++;
  17. }
  18. active proctype Finish()
  19. {
  20. run counting();
  21. run counting();
  22. barrier == 2; /* wait for counting to complete */
  23. assert(cnt==20);
  24. }



prev 0/0 next