More threads than processors in raytracer ...

Jan 6, 2011 at 5:36 PM
Edited Jan 6, 2011 at 5:36 PM

Hi - just a small code change so that also my small laptop (with 1 processor) shows the multi-threaded behavior ... obviously not for performance reasons:

MainForm.cs:

namespace Microsoft.ParallelComputingPlatform.ParallelExtensions.Samples {
    public partial class MainForm : Form {

       ...

        private void tbNumProcs_ValueChanged(object sender, EventArgs e) {
            _degreeOfParallelism = tbNumProcs.Value;
            lblNumProcs.Text = _degreeOfParallelism.ToString();
            lblNumProcs.ForeColor =
                _degreeOfParallelism > Environment.ProcessorCount
                    ? System.Drawing.Color.Red
                    : System.Drawing.Color.Black;
        }

        private void MainForm_Load(object sender, EventArgs e) {
            tbNumProcs.Minimum = 1;
            tbNumProcs.Maximum = 25;
            tbNumProcs.Value = tbNumProcs.Minimum;
            lblNumProcs.Text = tbNumProcs.Value.ToString();
        }

       ...

   }

}

Regards

Harald M.

Jan 11, 2011 at 9:35 PM

Many thanks!