Guest User

Untitled

a guest
Oct 21st, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. public static void Opgave41()
  2. {
  3. while (true)
  4. {
  5. Monitor.Enter(lockThis);
  6. try
  7. {
  8. tal += 2;
  9. Console.WriteLine(tal);
  10. Thread.Sleep(1000);
  11. }
  12. finally
  13. {
  14. Monitor.Exit(lockThis);
  15. }
  16.  
  17.  
  18. }
  19. }
  20.  
  21. public static void Opgave42()
  22. {
  23. while (true)
  24. {
  25. Monitor.Enter(lockThis);
  26. try
  27. {
  28. tal--;
  29. Console.WriteLine(tal);
  30. Thread.Sleep(1000);
  31. }
  32. finally
  33. {
  34. Monitor.Exit(lockThis);
  35. }
  36. }
  37. }
Add Comment
Please, Sign In to add comment