2 using System
.Threading
;
5 const int num_threads
= 10;
6 public static Barrier barrier
= new Barrier (num_threads
+ 1);
8 public static void ThreadFunc ()
10 object lock_obj
= new object ();
13 barrier
.SignalAndWait ();
14 Monitor
.Wait (lock_obj
);
15 } catch (ThreadAbortException
) {
21 public static void Main (string[] args
)
23 Thread
[] tarray
= new Thread
[num_threads
];
25 for (int i
= 0; i
< num_threads
; i
++) {
26 tarray
[i
] = new Thread (new ThreadStart (ThreadFunc
));
30 barrier
.SignalAndWait ();
32 for (int i
= 0; i
< num_threads
; i
++)
35 for (int i
= 0; i
< num_threads
; i
++)