Can someone help to understand the advantage, if any, when using CreateAnonymousThread or Task?
Can someone help to understand the advantage, if any, when using CreateAnonymousThread or Task?
Can be my impression only, but Task seems to be slow?
Can be my impression only, but Task seems to be slow?
/thread-safe sub
ReplyDelete/sub
ReplyDeleteI'm not sure what your question is. You can create many Tasks, and a thread pool will execute them. If you create hundreds of threads, they'll run at the same time, competing for resources.
ReplyDelete/sub
ReplyDeleteTasks are not slow - but there is some overhead which can count if you only have very short running work for the tasks. But that is the same with threads.
ReplyDeleteRuleOfThumb: Use a thread for long runners and tasks for the rest.
Oliver Münzberg "Use a thread for long runners and tasks for the rest."
ReplyDeleteThank you for the tip, gonna follow the rule.
/sub
ReplyDelete