首页 > 其他 > 详细

Differences Between Task And Thread

时间:2019-05-30 13:36:47      阅读:82      评论:0      收藏:0      [点我收藏+]
  1. The Thread class is used for creating and manipulating a thread in Windows. A Task represents some asynchronous operation and is part of the Task Parallel Library, a set of APIs for running tasks asynchronously and in parallel.
  2. The task can return a result. There is no direct mechanism to return the result from a thread.
  3. Task supports cancellation through the use of cancellation tokens. But Thread doesn‘t.
  4. A task can have multiple processes happening at the same time. Threads can only have one task running at a time.
  5. We can easily implement Asynchronous using ’async’ and ‘await’ keywords.
  6. A new Thread()is not dealing with Thread pool thread, whereas Task does use thread pool thread.
  7. A Task is a higher level concept than Thread.

reference:https://www.c-sharpcorner.com/article/task-and-thread-in-c-sharp/

Differences Between Task And Thread

原文:https://www.cnblogs.com/sufengsky/p/10949020.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!