Parallel Programming WS 2014/2015 - File Consumer.java
public class Consumer extends Thread { private int consumerIndex; private Buffer buffer; public Consumer(int i, Buffer b) { consumerIndex = i; buffer = b; } void consumeElement() { int elem = buffer.get(); } public void run() { while (true) { consumeElement(); try { Thread.sleep((int)(Math.random() * 2000)); } catch (InterruptedException e) {/* ok to ignore */} } } }
Generiert mit Camelot | Probleme mit Camelot? | Geändert am: 20.11.2014