Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.35 KB | None | 0 0
  1. import tango.core.Thread;
  2. import tango.io.Stdout;
  3.  
  4. Object x;
  5. static this() {
  6.   x = new Object;
  7. }
  8.  
  9. void thread_main() {
  10.   synchronized(x) {
  11.     throw new Exception("Oh no you don't");
  12.   }
  13. }
  14.  
  15. void main() {
  16.   auto t = new Thread(&thread_main);
  17.   t.start();
  18.  
  19.   for (auto i=0; i < 1000; i++) {
  20.     synchronized(x) Stdout(i).newline;
  21.   }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement