Bug 14787 - Using ParallelOptions with Parallel.For does not affect number of threads
Summary: Using ParallelOptions with Parallel.For does not affect number of threads
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2013-09-16 17:48 UTC by Bryan Moulton
Modified: 2015-03-30 10:07 UTC (History)
5 users (show)

Is this bug a regression?: ---
Last known good build:

Sample Project (31.09 KB, application/zip)
2013-09-16 17:48 UTC, Bryan Moulton

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Bryan Moulton 2013-09-16 17:48:12 UTC
Created attachment 4905 [details]
Sample Project

In reference to case #45992

Consider the following code:

Parallel.For (0, 10, new ParallelOptions(){ MaxDegreeOfParallelism = 10 }, i => {} );

If the lambda function has a blocking operation, additional threads will not start until previous operation(s) complete. This keeps the maximum threads being used at 2 instead of 10 as indicated by the MaxDegreeOfParallelism property.
Comment 2 Marek Safar 2015-03-30 10:07:10 UTC
Fixed in Mono 4.0