c# - Some items of Parallel.ForEach<T> runs on ThreadPool, some doesn't -
i have simple algorithm this:
parallel.foreach(mylist, new paralleloptions() { maxdegreeofparallelism = 4 } ,(job) => job.dosomething());
mylist list<mytype>
.
mytype has void dosomething()
.
inside dosomething
check thread.currentthread.isthreadpoolthread
. threads aren't "threadpooled";
the functions defined in parallel
use thread called function 1 of worker threads. non thread pool threads jobs done on thread called parallel.foreach
from.
Comments
Post a Comment