From 434a21b90cc42ea1ea0f44f2b7dc7a60b54b6e4c Mon Sep 17 00:00:00 2001 From: adash Date: Wed, 15 Apr 2009 23:48:28 +0000 Subject: [PATCH] Add new Barrier ...will need to change it to a better implementation --- Robust/src/ClassLibrary/JavaSTM/Barrier.java | 52 ++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Robust/src/ClassLibrary/JavaSTM/Barrier.java diff --git a/Robust/src/ClassLibrary/JavaSTM/Barrier.java b/Robust/src/ClassLibrary/JavaSTM/Barrier.java new file mode 100644 index 00000000..f8389c47 --- /dev/null +++ b/Robust/src/ClassLibrary/JavaSTM/Barrier.java @@ -0,0 +1,52 @@ +public class BarrierServer extends Thread { + int numthreads; + boolean done; + + public BarrierServer(int n) { + numthreads=n; + done=false; + } + + public void run() { + int n; + ServerSocket ss=new ServerSocket(2000); + atomic { + n=numthreads; + done=true; + } + Socket ar[]=new Socket[n]; + for(int i=0; i