All Questions
Tagged with task-parallel-library .net
22 questions
1
vote
1
answer
384
views
Request-response model over sockets/websockets
This is a request-response model over sockets/websockets (like HTTP) where you technically match request id to response id and return the response. In addition to that, there is timeout in case that ...
2
votes
2
answers
2k
views
Extension methods to modify an async Task's type from Task<IEnumerable<T>> to Task<List<T>>
I've written a lot of (await SomeTask).AsList(); in my project, and it's kind of annoying to keep wrapping it.
To fix this I've written a little extension method on ...
5
votes
1
answer
5k
views
SemaphoreSlim extension method for safely handling cancellation and disposal
I have often found myself using a try {semaphore.Wait()} finally {semaphore.Release()} pattern when using a semaphore, so decided I wanted to try and write an ...
1
vote
1
answer
140
views
Concurrent usage of resources
Please take a look at the following code. This is my attempt at understanding concurrent applications.
...
6
votes
2
answers
6k
views
ForEachAsync extension method (a way to run an async operation on each item of a sequence in parallel)
In a recent project I worked on we faced some issues due to an excess of parallelization (thousands of threads were created and the overall result was a degradation of performance and several spikes ...
2
votes
2
answers
3k
views
C# Extending the DispatcherTimer - Intermission timer
I'm working on a WPF project where a timer with Pause/Resume functionality is required. The standard Windows.Threading.DispatcherTimer doesn't offer that, so I ...
2
votes
1
answer
1k
views
TPL Task tracker which keeps track of tasks
This class keeps track of tasks which are added and tries to remove them after certain delay. I tried doing it with CustomTaskScheduler but didn't get much in return.
Here is my related question on ...
5
votes
1
answer
873
views
Splitting a UTF-8 string into equal-sized byte-arrays for parallel processing
Based upon a question from Stack Overflow, I wanted to expand on the answer I wrote and define a solution that would support ordering the strings (after processing).
So this starts off with a basic <...
6
votes
1
answer
231
views
Processing input in background while user is typing
Use case
A GUI with 2 controls:
An input control for text (a DNA sequence) that should be analyzed
A result control that displays the analyzing result of the entered text
The analysis takes 2-3 ...
1
vote
2
answers
1k
views
Parallel process interest in C#
In web api controller:
I am a newer in parallel and Async&Task programming. Need someone help me code review.
...
4
votes
3
answers
15k
views
Performing parallel processing on a file
I have some code that reads a file and then does some parallel processing of the data. There are millions of lines in the file and this section of the code is the bottleneck in my program. Any ...
4
votes
2
answers
547
views
Going to the thread pool and back using custom awaiters
I've figured out a way to switch threads in the middle of a method. The benefit of that seems super obvious to me: that's what everyone wants to do anyway, and splitting up methods, using callbacks, ...
3
votes
0
answers
243
views
Safely aborting thrid-party code using TPL
I'm using some third-party libraries in my project. Once in a while the code in these libraries freaks out and produces infinite loops and other nasty things. My goal is to write a wrapper that allows ...
4
votes
1
answer
5k
views
Refreshing customer list periodically in the background
I have a method RefreshCustomersInternal that refreshes customer data from a server and returns a Task. Since this process is ...
12
votes
1
answer
10k
views
Throttle actions by number per period
I want to throttle asynchronous actions at a specific maximum rate of n actions per t period, and have pending actions wait until there is a free slot (rather than drop them). I want to receive the ...
3
votes
1
answer
688
views
Event Subscriber with Parallelism
I am trying to exploit asynchronism for parallelism. This is my first attempt at a parallel event subscriber. In your expert opinions, is this a valid approach?
...
4
votes
2
answers
21k
views
Speeding up Parallel.ForEach iterating through datatable and rendering report
I am attempting to speed up the processing of 5000 rows received from the database, which I then render as a crystal report, export to a byte stream and save in a database table.
Currently I am using ...
3
votes
1
answer
606
views
Run control tasks asynchronously using TPL
One of my classes regularly triggers one of two asynchronous operations: a "turn on" and a "turn off" that each take about a second. I'm using this method below to make sure that they don't run ...
3
votes
1
answer
826
views
Barnes-Hut implementation of the N-Body problem translated from F# to C#
I am after a peer review of a C# implementation of the Barnes-Hut algorithm which I have translated from F#. The F# version is the base for comparison, therefore the C# version is suppose to reflect ...
1
vote
1
answer
2k
views
Converting a method to async
I have a method that calls a "bridge" for TraderMarketInfo. When info is received, it checks if info IsSet and raises an event. ...
6
votes
1
answer
8k
views
Use and understanding of async/await in .NET 4.5 +
I am just about to embark upon a massive job of multi-threading a cost-engine. I could use TPL of which I am very familiar, but would like to leverage the async/<...
4
votes
2
answers
2k
views
UNC path exists monitor
This is my first attempt at trying to write a "monitor" class to determine if a UNC path is available. I need the monitor to not block the main thread and to also event when the UNC is toggled UP/DOWN ...