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.

learn more… | top users | synonyms

3
votes
0answers
104 views

Socket application using TPL

This is an application I wrote that allows multiple TCP clients to share a single TCP connection to a remote server (hosted project, and a demo). Traffic generated by the server is forwarded to all ...
1
vote
1answer
63 views

WebAPI Handling fire and forget exceptions

This is a fire and forget task from within an existing WebAPI service. The code below simply sends a log event (might be that a client has connected to the service to perform some task) to another ...
3
votes
3answers
127 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 ...
0
votes
1answer
44 views

Tree processing for series and parallel execution

I have a tree processing application where some of the nodes are "executed" in parallel and some in series. I managed to do this but I feel that the solution looks a bit "hacked up" and can be ...
3
votes
2answers
51 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, ...
2
votes
1answer
147 views

Parallel Task Queue that runs in sequence

I'm in need of a solution that runs constantly incoming requests in a per-resource sequence, but parallel in general. The use-case: Many clients connect to a server and start issuing work. The work ...
0
votes
1answer
475 views

Starting a fire and forget async method

Sonar/FxCop are telling us that we shouldn't use void async methods. That's ok. This is the current implementation: ...
1
vote
0answers
169 views

Are there pitfalls to this solution to read messages from a queue in parallel?

I've posted a question on stackoverflow: How can I consequently read messages from a queue in parallel? I would like my own answer to be reviewed. Situation We have one message queue. We would like ...
7
votes
3answers
117 views

Downloading files from a Mozilla file server via FTP

All classes on GitHub repo This is the code for downloading files from a FTP-server running Mozilla Fileserver. FtpItem is the interface for the two classes ...
3
votes
1answer
95 views

Suggestion for a lot of chained Task [closed]

I have a lot of Task continuation that depend on .Result of previous Task -> for example: I ...
10
votes
3answers
255 views

Parallelized download of multiple images based on URL

I decided to rewrite a previous program of mine from scratch. The result is a lot better than the previous one but now that it seems like it is working I want to optimize it (hopefully it is not too ...
5
votes
1answer
85 views

Multithreaded Mandelbrot Generator Ver 3

I thought Ver 2 was fairly solid but ending up modifying all but one method for Ver 3. Performance for Generate is the same, but I was able to simplify the method ...
10
votes
3answers
445 views

Multithreaded Mandelbrot Generator Ver 2

Update: Version 3 is here. My first version was an answer I provided to EBrown for his original post titled "Multithreaded Mandelbrot Generator". My answer had many good things in it, but I felt ...
37
votes
3answers
5k views

I'm in your .zips crackin' your passwords

As an attempt to learn multithreading better, I wrote a program to crack the password of a ZIP file. It is sort of slow, processing a three-digit password of the 95 printable ASCII characters in ...
1
vote
0answers
49 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 ...
1
vote
2answers
74 views

Generate all available numbers for pattern, shuffle and save to multiple files

I've build simple application that allows me to generate all numbers that have desired length and start with prefix. For example if I specify 12 as prefix and set ...
3
votes
1answer
71 views

Await state async

For speed we sometimes return response to consumer before state is saved in DB. Sometimes (Mostly for our automated consumers) this can break because the want to make actions on the saved data before ...
2
votes
0answers
85 views

Implementing TAP around WMI

I'm trying to improve my skills with the Task-based Asynchronous Pattern (TAP), by writing simple task-based wrappers around some WMI methods: ...
2
votes
1answer
131 views

Thread-safe database updates

I have the following method that will return VariantID for given VariantName ("Name" in db). To avoid calling my db few thousand times I have dumped all records (~30) to the simple dictionary. I'm ...
3
votes
1answer
85 views

Simple wrapper to use IEnumerable as a producer in a producer-consumer pattern

I have a relatively simple problem: I have an IEnumerable<T>, which takes considerable time to yield each term. This is then used by another piece of code, ...
2
votes
2answers
132 views

Optimized ulong prime test using 6k+/-1 in parallel threads with C#

For primality testing of 64 bit ulong, I have optimized a very fast trial-by-division test using possible factors of the form 6k+/-1. For input numbers less than ...
4
votes
1answer
416 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 ...
6
votes
1answer
872 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 ...
8
votes
1answer
2k views

TPL inside Windows Service

I need to perform few tasks inside a Windows Service I am writing in parallel. I am using VS2013, .NET 4.5 and this post shows that TPL is the way to go. I was wondering if anyone can tell me if I ...
4
votes
2answers
367 views

High udpclient CPU use

I have a bunch of different ports I want to listen on and the iterate over the available data to send to a Dataflow pipeline. In total I'm listening on 14 ports. I'm looking for any advice on how to ...
12
votes
2answers
797 views

Wait, is that variable ever assigned?

One of the inspections we wanted to implement in Rubberduck for the next release, is one that finds all unassigned variables in a VBA project. Implementing this inspection has been ...complicated ...
5
votes
2answers
99 views

Forced Async operation in a (event like) method

I have a piece of code that I am not feeling comfortable. I don't want to block the UI Read operation works synchronously (reading may broke 50 ms rule) Save operation supports async (returns ...
4
votes
2answers
862 views

Measure a given method's execution time - follow-up

A long time ago, I've written a method that would allow me to measure the amount of time a method takes to run. I've decided to tweak this method and make use of TPL since measuring a method may take ...
5
votes
2answers
190 views

Parallelizing bitmap methods

I created a class called QuickBitmap to quickly get/set pixels in a Bitmap object. Using intertops I'm able to safely lock/unlock the bits of the ...
2
votes
1answer
187 views

Batcher using Microsoft.Tpl.Dataflow

What do you think? In particular, I'm not sure about my exception handling approach to raise errors when posting objects; but I couldn't come up with anything better. ...
5
votes
1answer
337 views

Achieving a never-ending loop of game tasks

The following is a basic implementation of a loop which is intended to launch a series of games in a loop (generic ones that can be overridden, but that have always have finite durations). The ...
3
votes
1answer
106 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
2answers
4k 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
172 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 ...
3
votes
1answer
1k 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 ...
4
votes
1answer
2k 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. ...
2
votes
2answers
3k 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
1k 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
3k 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
1k views

Tasks and WaitAll\WhenAll

Could you help me to speed up/optimize this code: ...
11
votes
3answers
895 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
1k 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 ...
3
votes
1answer
423 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
5k 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 ...
7
votes
1answer
6k 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
935 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
14k 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 ...
7
votes
1answer
6k 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
3k 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
420 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 ...