task-parallel-library
Task and Task.WaitAll with timeout exception handling
When waiting for Tasks using Task.WaitAll and specifying a timeout if the WaitAll times out do I also have to separately observe any unfinished tasks (e.g. by registering a continuation)?[详细]
2023-03-29 15:46 分类:问答Why is a task continuation for a child task not triggered when parent is cancelled?
Consider the following C# code: CancellationTokenSource tCancelSource = new CancellationTokenSource();[详细]
2023-03-29 05:26 分类:问答How do I chain a task to another task without knowing the first task's result type
Suppose I have an API that returns a Task as an object: private static object CreateTask() { return Task.Factory.StartNew(() => \"Task string\");[详细]
2023-03-28 18:16 分类:问答Parallel tree traversal in C#
I need to traverse a tree quickly, and I would like to do it in parallel. I\'d rather use the parallel extensions than manually spin up a bunch of threads.[详细]
2023-03-28 16:17 分类:问答How do I abort a .NET task?
Here\'s the situation, I am writing the framework for a code war contest. As the code runs, for each turn, it calls a method in the library provided by each contestant. The rules of the contest is the[详细]
2023-03-28 03:22 分类:问答Task Parallel Library and Loops
I have come across a situation where Tasks I am creating only seem to work when I am debugging the code.[详细]
2023-03-27 21:40 分类:问答StaTaskScheduler (TPL Extension) and WebBrowser Control WPF - Wrong Thread
I want to download a web site with the WebBrowser Control (WPF) in the Background and parse the site afterwards. The download should be in a "tight loop\". I only need the source as a string. I t[详细]
2023-03-27 06:21 分类:问答When to dispose CancellationTokenSource?
The class CancellationTokenSource is disposable. A quick look in Reflector proves usage of KernelEvent, a (very likely) unmanaged resource.[详细]
2023-03-26 09:43 分类:问答Processing only n items at a time concurrently using Task Parallel Library
This is all happening in a windows service. I have a Queue<T> (actually a ConcurrentQueue<T>) holding items waiting to be processed. But, I don\'t want to process only one at a time, I wa[详细]
2023-03-26 03:59 分类:问答Thread-safe buffer of data to make batch inserts of controlled size
I have a simulation that generates data which must be saved to database. ParallelLoopResult res = Parallel.For(0, 1000000, options, (r, state) =>[详细]
2023-03-25 11:07 分类:问答