Parallel library vs Native Thread Synchronization task

This question may be subjective, but I just want to know when to use TPL and when to use my own thread synchronization (evnts, wait handle).

Will there be outdated methods for synchronizing your own threads?

thank

+5
source share
3 answers

Use TPL wherever you are, because it is a cleaner, more declarative way to express your needs for parallelism.

MSDN : "TPL concurrency , . , TPL , ThreadPool, , . TPL, , , ".

. http://www.albahari.com/threading/part5.aspx, " Parallelism" TPL.

+4

. . , ForEach foreach, . .

(, -), - . , WCF IIS .

, , .

+1

, . TPL :

  • .
  • .
  • Combine results as they appear in thread safe and efficient mode.

And only the third element is associated with thread synchronization. And, of course, you can still use the well-known thread synchronization primitives to execute the match result in thread-safe mode (for example, using the Parallel class when you must match this result yourself).

+1
source

All Articles