private void PrintThreadCurrentNodePage(PowerThread thread) { Console.WriteLine("-----------------------------------------------"); Console.WriteLine(thread.CurrentNode?.Name + " " + thread.State); Console.WriteLine(thread.CurrentNode?.DefaultForm?.RenderHtml()); //Console.WriteLine(thread.CurrentNode.DefaultView.RenderHtml()); Console.WriteLine(); }
// Calculate (m^n) / (m*n) public static void Main() { int m = 20; int n = 200; // Create a m^n calculation thread PowerThread pt = new PowerThread(m, n); Thread t = new Thread(new ThreadStart(pt.Calculate)); // Start m^n calculation in parallel t.Start(); // Now we do our own calculation while the PowerThread is calculating m^n // TODO: Compute the sum of the diagonal elements of current value double result = m * n; // Wait till the PowerThread is finished t.Join(); // Display result Console.WriteLine("({0}^{1}) / ({0}*{1}) = {2}", m, n, pt.result / result); }
private void PrintThreadCurrentNode(PowerThread thread) { Console.WriteLine(thread.CurrentNode?.Name + " " + thread.State); }