MonoTouch在其网站上宣传支持AsParallel
,以下是代码片段:
from item in items.AsParallel ()
let result = DoExpensiveWork (item)
select result;
然而,即使是一个微不足道的示例也会导致我的应用程序崩溃:
var items = new [] { 1, 2, 3 };
var twice = (
from x in items.AsParallel()
select 2 * x
).ToArray();
MonoTouch版本是5.3.5。
对于Parallel.ForEach也是一样的情况:
System.AggregateException: One or more errors occured ---> System.Exception:
Attempting to JIT compile method 'System.Threading.Tasks.Parallel:<ForEach`1>m__36<int> ()' while running with --aot-only.
See http://docs.xamarin.com/ios/about/limitations for more information.