[Mono-list] PFX still doesn't work correctly (in Mono 2.6.4)
Yury Serdyuk
Yury at serdyuk.botik.ru
Wed Jul 7 18:45:10 EDT 2010
Jérémie Laval wrote:
>The other 100% thread is simply your main thread waiting on completion of
>the loop, it's not like it would do useful work (although it could indeed
>not be 100% there, I will look into that).
>
>
In any case, Microsoft PFX doesn't demonstrate such behaviour -
again, if we start the code
>>using System;
>> using System.Threading;
>>
>> public class Test_PFX_For {
>>
>> public static void Main ( String[] args ) {
>>
>> int num_threads = Convert.ToInt32 ( args [ 0 ] );
>>
>> ParallelOptions po = new ParallelOptions
>> {
>> MaxDegreeOfParallelism = num_threads
>> };
>>
>> Parallel.For ( 0, 100, po, i =>
>> {
>> long k = 0;
>> while ( true ){
>> k++;
>> k--;
>> }
>> });
>> }
>> }
>
like
>Test_PFX_For.exe 1
then, as we expect , only one thread has been started.
Yury.
More information about the Mono-list
mailing list