From 0113a6f80daf5ea7ffdef042b0af4668421a6670 Mon Sep 17 00:00:00 2001 From: Niklas Bretz <niklas.bretz@student.reutlingen-university.de> Date: Mon, 12 Dec 2022 14:26:55 +0000 Subject: [PATCH] Added comments --- Aufgabe3/ConsoleApplication1/Program.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Aufgabe3/ConsoleApplication1/Program.cs b/Aufgabe3/ConsoleApplication1/Program.cs index 52a3076..26bb255 100644 --- a/Aufgabe3/ConsoleApplication1/Program.cs +++ b/Aufgabe3/ConsoleApplication1/Program.cs @@ -12,36 +12,43 @@ namespace ConsoleApplication1 { public static void Main(string[] args) { - + + //Parse received program arguments to ints int nrProd = int.Parse(args[0]); int nrCons = int.Parse(args[1]); Buffer b = new Buffer(); + //Create n new producers where n = received argument for(int i = 0; i < nrProd; i++) { + //create new Producer object Producer p = new Producer(b); + //create new Thread and start it Thread newThread = new Thread(p.produce); newThread.Start(); } + //Create n new consumers where n = received argument for (int i = 0; i < nrCons; i++) { + //create new Consumer object Consumer c = new Consumer(b); + //create new Thread and start it Thread newThread = new Thread(c.consume); newThread.Start(); } } - +/* static void setAsleep() { Thread.Sleep(8000); Consumer.wakeUp(); } - +*/ } } -- GitLab