Comments
3 comments
-
There is no such library System.Threading.dll in .Net framework from Microsoft. System.Threading is a namespace in mscorlib.dll. I have not found Parallel class in mscorlib.dll. What version of .Net framework which is installed in your system?
-
I think this is an experimental thing, however, you might try View > Options, and then switch "Optimization" to ".NET 3.5" to see if that makes any difference.
Hope that helps.
Thanks,
Bart -
In fact, the result is (a little bit) better if you revert to .NET 1.0 optimizations. This way, Reflector won't try to display anonymous delegates and will revert to a .NET 1.0 syntax, (with inner classes). But because these classes are generated, their name isn't C# compliant and it won't compile. In these sort of case, I use global renamings (replacing each invalid character in a name by an underscore, and hopping I won't have collisions).
For instance here the same piece of code with .NET 1.0 optimization:using (Task task = Task.Create(new Action<object>(class2.<ForWorker>b__3), manager, options | TaskCreationOptions.SelfReplicating)) { task.Wait(); }
And if you go to the <ForWorker>b__3 method, you can see this:int sharedIndex; int num3; int step = this.step; do { sharedIndex = this.sharedIndex; num3 = sharedIndex + step; if (num3 < sharedIndex) { num3 = 0x7fffffff; } }
Better, isn't it?
And for information, System.Threading.dll is new and not yet RTM, but so useful! It is the new Microsoft Parallel extensions for .NET
Download it here: http://www.microsoft.com/downloads/deta ... laylang=en
Add comment
Please sign in to leave a comment.
using (Task task = Task.Create(delegate {
int num1int num3int num2 = base.stepdo {
num1 = base.sharedIndexnum3 = num1 + num2if (num3 < num1)
{
num3 = 2147483647}
}
while (Interlocked.CompareExchange(ref sharedIndex, num3, num1) != num1);
as you can see the syntax is unreadable.
optimization: .net 3.5
reflector: free 5.1.3.0