diff --git a/task4/screenshot.png b/task4/screenshot.png new file mode 100644 index 0000000..0ebf9d4 Binary files /dev/null and b/task4/screenshot.png differ diff --git a/task4/src/main/java/TaskRunner.java b/task4/src/main/java/TaskRunner.java index b6963d7..6b0905b 100644 --- a/task4/src/main/java/TaskRunner.java +++ b/task4/src/main/java/TaskRunner.java @@ -28,7 +28,21 @@ public TaskRunner(Object mutex, String msg, int cnt) { @Override public void run() { - //TODO sleep 500 + synchronized (mutex) { + while (iter < 100) { + if ((iter % 3) == cnt) { + list.add(message); + iter++; + mutex.notifyAll(); + } else { + try { + mutex.wait(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + } } }