Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create devices in nonsequential order #15

1RedOne opened this issue May 9, 2019 · 2 comments


None yet
1 participant
Copy link

commented May 9, 2019

Let's look into creating the devices sequentially to be more obvious that it is working.


This comment has been minimized.

Copy link
Owner Author

commented May 23, 2019

Here's how device numbers are chosen now. Imagine we create 200 devices, using 4 threads.

Thread 1 - Device001
Thread 2 - Device049
Thread 3 - Device100
Thread 4 - Device150

This is how the device names are completed now. We could instead create a ConcurrentQueue to handle this request. I'm not sure how much work it would required to replace our current structure of Parallel.ForEach with this approach.

Parallel.ForEach(DeviceList, new ParallelOptions { MaxDegreeOfParallelism = maxThreads}, device =>
Device ThisDevice = new Device() { Name = device, Status = "Starting...", ImageSource = "Images\\step01.png", ProcessProgress = 10 };
int thisIndex = devices.IndexOf(ThisDevice);

@1RedOne 1RedOne added this to the 2.2 milestone May 23, 2019

@1RedOne 1RedOne added the help wanted label May 23, 2019


This comment has been minimized.

Copy link
Owner Author

commented May 24, 2019

I was actually distracted looking at that this morning and came up with some untested code. I think this will make the make the device names get created in pseudo-succession rather than uniformly distributed in the list.

— Chris Muster (@mustercj) May 23, 2019
<script async src="" charset="utf-8"></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.