RE: Don't use threads, use tasks instead. 03-30-2016, 02:27 AM
#5
(03-30-2016, 01:40 AM)Killpot Wrote:Now now you've gotten grumpy here :tehe:(03-29-2016, 09:32 PM)Coefficient Wrote: fuck my life i just made a 30 minute long well detailed post but chrome is autistic and reloaded the page when i pasted something in.
Ill still make a short resume though.
Ik this is straightforward but tasks are more efficient then threads because of several reasons, being better resource wise, somewhat more control (over customization).
Which is somewhat a disadvantage because if you plan on tasking 100 different threads to do 100 different actions, it's gonna take a lot resource wise. While tasks can be done on one thread asynchronously and can easily be modified to be parallel and thread-safe.
TaskCreationOptions.LongRunning
It is actually the opposite, threads are more oftenly used by beginners because it is a way simpler concept of understanding and basically an easier way of doing then tasks. Tasks being more funky and introducing the await and async keywords with more abstart concept make beginners stay away from it.
I also understand, yes you are somewhat right that threads can have more impact on the OS though tasks should rather be used from my point of view.
Here is a StackOverflow link that briefly explains the difference between tasks and thread
http://stackoverflow.com/questions/13429...ifferences
Some more quick links:
http://www.c-sharpcorner.com/blogs/task-...n-c-sharp1
http://blogs.msdn.com/b/pfxteam/archive/...03475.aspx
Anyways id like to explain some more but im done typing.
That feel I know all too well, I've had it happen to me more times than I like to admit, now I just cautiously Ctr-A + C every couple of seconds while posting...



![[+]](https://sinister.li/images/modern/collapse_collapsed.png)