The Task Parallel Library is part of .NET 4 and .NET 4.5. It is a set of APIs to enable developers to program asynchronous applications.
3
votes
0answers
22 views
SignalR pool of tasks executing long running job
I have a SignalR Hub within ASP.Net application that can start different tasks
...
4
votes
2answers
74 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 ...
5
votes
1answer
46 views
Server that supports two types of connections
I'm wonder if my approach is correct. I'm trying to make a WinForms server that processes data from 3 sides:
from bluettoh (InTheHand library) as source data which I need to process in server
to ...
2
votes
1answer
99 views
TPL Dataflow BatchBlock with Batch Size & Timeout
I needed BatchBlock with support for timeout (act greedy on what it received at that time) and by some search and study, this is the outcome.
What are drawbacks or ...
1
vote
1answer
81 views
Monitoring progress in Parallel.ForEach every minute
I'm using Parallel.ForEach to download 500K URLs and I want to monitor the number of URLs that have been successfully downloaded each minute.
...
1
vote
2answers
132 views
Queue with task parallel library
I am new to programming using the .Net TPL Framework and multi-threading in general. I have googled up some tutorials and articles and put together the solution below.
It is a simple multithreaded ...
4
votes
1answer
121 views
Avoid while(true) in task scheduling code
I am writing a task scheduler (that will one day grow up to be a windows service when I look into them) that should pretty much loop infinitely until I tell the program to stop. But having ...
1
vote
1answer
189 views
Creating Thread Safe or Concurrent List [closed]
Can a thread safe or concurrent list be created using the code mentioned underneath, where I wrap all the calls to the base class in a ReaderWriter lock. I can similarly implement all the public ...
2
votes
1answer
128 views
11
votes
3answers
693 views
WhenAll for .NET 3.5
I am trying to write a version of Task.WhenAll for .NET 3.5 using the "Task Parallel Library for .NET 3.5". This is what I came up with. Is there a better way of ...
8
votes
1answer
305 views
Asynchronous retry method
I've written an asynchronous retry method as an answer for this question. I'd like to get your opinion of the implementation and whether there are better ways to implement this. You could also ...
2
votes
1answer
105 views
Cross Thread Access to Object in ViewModel
This is a fairly straight forward question. I have a C# WPF MVVM application that call a C++ DLL to do some compilation/crunching. To update the UI C# application for progress updates I am using ...
4
votes
1answer
325 views
Simple parallel foreach loop code correctness
I have both the regular for each loop and its equivalent paralleled version. The loop simply iterates through a collection, looking for the rate key in a local db ...
6
votes
1answer
1k views
Writing highly asynchronous code
I am writing a new web service that will be performing a lot of large data load operations. To do so I am moving the data to a temporary table then merging the data in to the live data via a stored ...
3
votes
1answer
212 views
TaskScheduler that uses a dedicated thread
I'm trying to implement a TaskScheduler that runs all tasks in the order they are submitted, on a single dedicated thread. Here's my implementation, using a BlockingCollection:
...
5
votes
2answers
4k views
A TaskScheduler that always run tasks in a specific thread
The following is an TaskScheduler that always run tasks in a thread it maintains.
When created, a name of the thread was specified. Once you schedule the first ...
4
votes
1answer
1k views
Async Queue Processing
I have a Queue that needs to try to process when anything updates in it (add, remove or update).
However, I don't want any of the callers to wait while the ...
5
votes
2answers
973 views
Listen to multiple RabbitMQ queue by task and process the message
Single app which listen to multiple RabbitMQ queue and process the message. This is working fine but not sure this implementation is right one or I am missing something.
Implementation is inspired ...
2
votes
1answer
128 views
Run the most recently requested action after finishing current, skip middle tasks
The goals for the code below are in the class summary below. Can anyone see that the code fails at any of those goals? I'm unsure how to thoroughly test it. Is there a way to keep the Queue method ...
12
votes
2answers
5k views
Websockets client code and making it production-ready
The following code is helpful to anyone who uses websockets in general... and is probably good template for anyone getting started in this area. I'd like to flesh this out into something that is more ...
11
votes
2answers
2k views
BackgroundWorker vs TPL ProgressBar Exercise
I wanted to fiddle around with the BackgroundWorker and Task classes, to see how I would implement a given task with these two ...
3
votes
1answer
170 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 ...
5
votes
1answer
349 views
Non locking UI code in WP8
I've recently started to delve into the world of windows phone 8 dev, and as a learning experience I've decided to make a stopwatch application. Now, given I've been a web guy most of my career, I've ...
2
votes
0answers
174 views
Easy way to handle AcceptMessageSessionAsync and ReceiveAsync - Windows Server ServiceBus
Attempting to jump into the Windows Server ServiceBus 1.1 code-base along with adopting the new TPL async methods. But I could not find an easy way to just spin up N number of handlers for message ...
8
votes
1answer
640 views
Implementing a cancellable “infinite” loop
I'm making a Windows service that watches a directory for new files to process them.
I hit a race condition between the file copying going on and me trying to process it. Going by a SO answer I wrote ...
2
votes
1answer
602 views
Generic Task Progress Dialog
I'm attempting to write a Progress Dialog that I can instantiate, show and then pass a task to complete to. I'm pretty new to Task Based Patterns, so please bear with me.
Ideally my goal is to be ...
5
votes
2answers
134 views
Is Concurrent Collection Needed Here?
I'm playing around with switching some code to using Parallel.ForEach and I have a question about whether I need to be concerned about the effects of concurrency ...
2
votes
1answer
98 views
parallel.For function
I am trying to add parallelism. The following function works. For testing purposes, calculating chunckLength is fine. However, when I allocate more cores, it seems ...
2
votes
1answer
209 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 ...
3
votes
1answer
1k views
Filtering a collection by an async result
I'm trying to do something like this:
var loudDogs = dogs.Where(async d => await d.IsYappyAsync);
The "IsYappyAsync" property would return a ...
1
vote
1answer
138 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. ...
7
votes
2answers
11k views
Console chat server
I'm just looking for feedback on correctness of my understanding of async/await. I'm curious about the Task.Run inside of the ...
1
vote
2answers
85 views
TaskFactory.CompleteWhenBoth
I'm trying to construct something which would work a bit like Zip for two tasks, but I'm a bit worried about race conditions in this code.
...
0
votes
1answer
226 views
Using Barrier to Implement Go's Wait Group
I have implemented a WaitGroup class to simulate WaitGroup in Go lang. Then I've found that I can use Barrier in a different manner, to achieve the same thing. My WaitGroup has some additional ...
3
votes
2answers
2k views
Tasks: exceptions and cancelation
I need to do a long running task. I've done this by executing a Task while there's a loading box on the UI. When an exception is thrown, I want to stop the task and show a msgbox to the user. If ...
3
votes
1answer
436 views
File/folder watcher Windows service
I am developing a C# Windows service that will always watch different folders/files and DB query results on different time intervals. There can be dozens of watchers each watching a specific file or ...
7
votes
1answer
5k views
C# 5 Async Await .Task.Factory.StartNew cancellation
I have the async code that implements cancellation token. It's working but Im not pretty sure if this is the right way to do it so I just want feedback about it.
Here is the actual code:
...
7
votes
2answers
783 views
Task.Finally extension, good, bad, or ugly?
I wrote this, and it has helped to avoid the 'Some exception weren't handled' problem. Is there something glaringly wrong with this that I might have missed?
...
3
votes
1answer
4k 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 ...
1
vote
1answer
1k views
TPL Thread Leak and Memory Leak
I'm trying to track down what I suppose to be memory/thread leak in one of my programs.
My program uses a function to upload a file to a Windows Azure Storage Blob. In order to make this function ...
4
votes
2answers
451 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 ...
2
votes
1answer
7k views
Correct approach to wait for multiple async methods to complete
I have an IWorkflow interface defined as follows:
...