public class MyThread : Object { public int lock_var = 0; public int increase_lock_var () { var ret = 0; lock (lock_var) ret = ++lock_var; return ret; } public int run () { for (var i = 0; i < 8; ++i) { var tmp = 0; lock (lock_var) tmp = lock_var++; stdout.puts (@"thrd:$lock_var\n"); Thread.usleep(100); } return 0; } } void main () { var mt = new MyThread (); var t = new Thread ("Debugging thread name", mt.run); for (var i = 0; i < 8; ++i) { var tmp = mt.increase_lock_var (); stdout.puts(@"main:$tmp\n"); Thread.usleep(100); } t.join (); }