Skip to main content

Questions tagged [task-parallel-library]

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.

15 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
13 votes
0 answers
3k 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 ...
KFL's user avatar
  • 231
4 votes
0 answers
64 views

Coordination function

This function started very clean but I had to add requirements: Added a Stopwatch to only update the caller periodically. I guess that responsibility could be ...
user875234's user avatar
3 votes
0 answers
7k views

What is better - using SerialPort with or without await/async methods?

I'm having an implementation using SerialPort in C# using Visual Studio 2019. I'm using it in a Windows Application, using .NET Framework 4.7.2. When I open and ...
Hans Billiet's user avatar
3 votes
0 answers
97 views

Making recurring requests to a web service using Task.Run

I am practicing with using Tasks and I put something together but am unsure if I used it properly. I read through Stephen Cleary's blog and it seems that it is okay but at the same time I do some ...
Svet Angelov's user avatar
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 ...
RX_DID_RX's user avatar
  • 263
2 votes
0 answers
587 views

Is there a more elegant syntax using "Task.WaitAll" for 2 tasks and timeout

I'm using the SerialPort in C# using Visual Studio 2019. My SerialPort has 2 "pump" tasks, which are private members of my SerialPort, and are started during an Initialization method: ...
Hans Billiet's user avatar
2 votes
0 answers
89 views

Execute asynchronous read in parallel

I found it useful to execute multiple reads in parallel using a set of my extension methods for TaskFactory, which could be used as: ...
Dmitry Nogin's user avatar
  • 6,121
2 votes
0 answers
350 views

Retry HttpClient request without handlers

I have a server and client application. In the client application, there are HttpRequestException class exceptions on requests. As it seems to me - these exceptions happen in isolated cases and not ...
Александр Пекшев's user avatar
2 votes
0 answers
131 views

Concurrent execution and coordination of C# tasks

I have a class, 'TaskCoordinator' which has 'BaseTask's applied to it. The BaseTasks have OnStarted, OnFinished and OnCancelled events which are triggered to notify the calling class of their events....
Timmoth's user avatar
  • 21
2 votes
0 answers
60 views

Task based GameObject recorder for networked game

I've recently been dipping my toes in to async code so I'm not 100% sure if there's a better way to do this, or if I'm going to run into problems down the road. I plan on using the following class in ...
itsDrew's user avatar
  • 21
2 votes
0 answers
582 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: ...
p.s.w.g's user avatar
  • 1,961
2 votes
0 answers
892 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 ...
user3220325's user avatar
1 vote
0 answers
828 views

Sending device data of 10k items with Parallel.ForEach

I have a deviceList of more than 10k items and want to send data by calling another method. I tried to use Parallel.Foreach but I'm not sure is this the correct ...
Neo's user avatar
  • 119
1 vote
0 answers
747 views

Using up to 15 connections to synchronize files from a FTP server with local files

Task: Create a service which will synchronize files on FTP server with files on local drive. FTP server allows up to 15 concurent connections Synchronize the files as fast as possible Files on FTP ...
inwenis's user avatar
  • 303
1 vote
0 answers
9k views

Very simple task scheduler (Task based, not Timer based)

My app has several periodic tasks. So I created this very simple generic task scheduler (got sick of copy-pasting code, which is based on Timers). It is very very basic and simple, can you find ...
jitbit's user avatar
  • 111