Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / mcr-test / src / buffertest / Worker.java
diff --git a/JMCR-Stable/mcr-test/src/buffertest/Worker.java b/JMCR-Stable/mcr-test/src/buffertest/Worker.java
new file mode 100644 (file)
index 0000000..2fe272f
--- /dev/null
@@ -0,0 +1,26 @@
+package buffertest;
+/* from http://www.doc.ic.ac.uk/~jnm/book/ */
+/* Concurrency: State Models & Java Programs - Jeff Magee & Jeff Kramer */
+/* has a deadlock */
+
+/********************CONSUMER*******************************/
+
+class Worker extends Thread {
+
+    int id;
+    BufferTest scheduler;
+    int numWorkers;
+    
+    
+    Worker(BufferTest sch, int id, int numWorkers) {
+       this.scheduler = sch;
+       this.id = id;
+       this.numWorkers = numWorkers;
+    }
+
+    public void run() {
+       this.scheduler.updateSum(this.id);
+       this.scheduler.updateCounter();
+    }
+
+}
\ No newline at end of file