This covers the asynchronous programming model supported by various programming languages, using the async and await keywords.

learn more… | top users | synonyms

1
vote
0answers
15 views

Indefinite loop in a coroutine vs. re-scheduling a coroutine

I recently started working with asyncio and coroutines. I have a coroutine that runs every 0.25 seconds to print "running ..." on screen indefinitely. When the script receives a SIGTERM or SIGINT it ...
0
votes
1answer
96 views

WPF async ObservableTaskQueue class

I'm currently working on a WPF application, making calls to various web APIs. Thus, I'm looking after a special observable tasks queue: Progress value must be available Tasks (API calls)/seconds must ...
2
votes
0answers
17 views

Parallel and Sequential array looping with async/await

Are these good implementations of parallel and sequential "extension" methods, and do they accomplish what I think they do? My understanding is that the first one is parallel because the await ...
3
votes
1answer
108 views

Try again, and again, and again… but not too often because the potatoes won't grow

The delay sequence has been fixed so I can move to the next step which are the Retry and Breaker. (Just ignore the console ...
2
votes
1answer
75 views

Ensuring no race conditions in my concurrent/parallel ForEachAsync method

Hopefully the final chapter of my ForEachAsync code review. The original question was the starting point and the second question contained modifications suggested ...
6
votes
3answers
494 views

Downloading blobs asynchronously

We have a working implementation that is doing I/O operations, returning data from blobs in an async/await manner from Azure Blob Storage. ...
2
votes
1answer
65 views

Concurrent/parallel ForEachAsync - proper handling of exceptions and cancellations

I've created an asynchronous parallel ForEach mechanism so I could enumerate an enumerable by N degrees of concurrency and process an action for each item. ...
2
votes
1answer
70 views

Creating a concurrent/parallel ForEachAsync that can fail immediately or wait until enumeration is complete

I needed an asynchronous parallel ForEach mechanism so I could enumerate an enumerable by N degrees of concurrency and process an action for each item. Searching ...
2
votes
0answers
50 views

Establishing a TCP connection with async & await

I'm not really super experienced async/await and working with tasks, so I thought I'd ask for some other opinions. I'm working with code written by someone else that establishes a TCP connection. It ...
6
votes
3answers
89 views

Visitor Pattern/Leaky Bucket variant implementation to run an operation at a certain interval

My code is a variant on the Visitor Pattern and a "leaky bucket" variant. The goal is pretty straightforward: the "bucket" will collect a specified number of items (say, for example, 500) and then ...
-1
votes
1answer
46 views

Download Images as fast as possible (task-based update) [closed]

Based on the excellent advice of some users here, I updated my code to do a task based implementation of my previously thread based implementation. This didn't work out of the gate, but I think it has ...
5
votes
1answer
813 views

Download Images as fast as possible

I have a spreed sheet and its something like 550+ columns and I need to pull URLs from it. Previously I was using LinqToExcel when the sheet was less than 255 columns a recent update has produced this ...
2
votes
0answers
93 views

Multithreaded download of images from a spreadsheet

I've been wanting to go async with my HTTP calls but all the methods I tried have not worked, so I resolved to implement this as a task and then improve upon it. This is what I've come up with so far....
3
votes
1answer
119 views

Client/Server, Asynchronous ping-pong exchange

I'm mainly wondering about whether or not I have used the (TAP) async/await pattern correctly. I get a bunch of these warnings, "Because this call is not awaited, execution of the current method ...
1
vote
1answer
87 views

Lazy Init if the Items property is null

I was refactoring a quite large WPF project and I found some pieces of code where it can leads to error. Ive got some services in the form ...
7
votes
1answer
325 views

Async TCP client/server

I'm working on a simple async TCP client server application, i'd like my network code to be reviewed. I really feel that I'm doing something wrong, especially in receiving code. Interface for client: ...
3
votes
1answer
65 views

A Switch for async function invocations

I have implemented a simple "switch" function - that switches and invokes an alternate function, if the function that is to be invoked fails or timesout. This code will be later employed as part of ...
4
votes
1answer
103 views

Task-Based Overlapped IO In .NET

I've been working wrapping the Windows API's Overlapped methods in the more usable Task based approach. There isn't much information out there on doing this, so I've been flying blind apart from a few ...
2
votes
1answer
326 views

WPF - Run an async Task with DispatcherTimer

I have a small application that checks some system status and display it details. I have the following code which is working. But I want to make sure it's optimal: ...
5
votes
1answer
389 views

Use of Async/Await for EventHandlers

I have a MVC WinForms application. I am using Dependency Injection with Ninject as the IoC container. ...
2
votes
1answer
84 views

Performance of an OLX crawler

I'm learning concurrency and asynchronous programming in C#. For a better grasp on the matter I'm trying to create an OLX Crawler. My issue here is the performance: It takes roughly 159 minutes to ...
3
votes
2answers
134 views

TPL Async Await in Console Apps

I just picked up Async Await and I am trying to use Async Await in Console App along with TPL for querying webservices. The code works fine and I am able to get the speed using HttpClient and async. ...
1
vote
2answers
280 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
0answers
371 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
votes
1answer
268 views

async tcp server using async/await

Here is an async Tcp server using async/await I have written. I would be very appreciate if anyone can help to improve my code. Thank you! ...
1
vote
1answer
872 views

Custom HttpClient Wrapper

I need to wrap httpClient because I'm using a custom token provider. I will use this code with asp.net mvc to communicate with our webApi2 server. ( Using webApi2 with directly from ui with angularjs ...
6
votes
1answer
102 views

Enumerating smart card terminals asynchronously in ViewModel constructor

I started a project the other day and started going down the path of using async and await as I have never used it before and it seems like a good match. The app that I'm making is a WPF solution ...
1
vote
2answers
102 views

Processing files retrieved through FTP in parallel

I am busy creating a file processor that needs to get some files from an Ftp client download the file and save the data into the database. I have a two part question. How can i refactor the code to ...
1
vote
2answers
114 views

Asynchronous lookup over HTTP and checking the status

For some reason declaring ApiResult before checking if the answer is in a correct status doesn't look good. I wonder if there is any better way to check the status ...
1
vote
1answer
195 views

Safe async API code

I'm pretty new to async/await and I want to ensure that the code I've written is going to be safe and not cause any deadlocks. The RestClient in the code will be ...
3
votes
2answers
70 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, ...
6
votes
3answers
217 views

ToPaginatedListAsync<T>

I'm using this method and I would likely have a code review. Also, I have one concern and is that source.Count() is executing synchronously and I don't know how to ...
2
votes
1answer
217 views

Buffered asynchronous writer

Imagine I have connection in which I have to write numbers, represented by this contract: ...
6
votes
2answers
74 views

Cancellable UI loader

I'm playing with async/await, but I have yet to discover a standard method to safely cancel an intensive task. I have tested the following, and it works exactly as intended, though I remain unsure if ...
1
vote
1answer
2k 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: ...
6
votes
1answer
328 views

Embedding an RSS feed into a page after it's already loaded

I'm working on reworking our website from a WYSIWYG editor to MVC. I'm all right with server side code, but complete rubbish when it comes to client side Javascript, so I'd appreciate any/all feedback....
1
vote
1answer
34 views

Socket.ReadPacketASync

I'm working with TCP Sockets and I've build a simple packet struct that turns it into a datagram protocol. I've created a class which returns "promise" Tasks for Packets. Packets are very simple, they ...
4
votes
1answer
116 views

Asynchronous start/stop state transitions

I have a third-party object with asynchronous start and stop methods. Each start and stop may fail with exception. The object is not re-entrant, i.e. I can only call its start or stop method after the ...
0
votes
1answer
65 views

Getting data async

I need to handle concurrent requests by waiting for the result of an already running operation. Is this code safe or does it contain bugs? ...
6
votes
1answer
261 views

Priorizatable command queue

This code consistently executes commands with a given priority. How can I to improve it? ...
3
votes
2answers
170 views

Mapping a user input string to a corresponding block of code

My idea is I can define a block of code (inline) that corresponds to an input string then can call that block of code when given that input. I'm used to this sort ...
1
vote
1answer
106 views

JavaFX await implementation

I'm debating trying to take a crack at getting something similar to C#'s async-co-routine like nature over on JavaFX. This is technically feasible since the Quantem toolkit exposes the ...
11
votes
3answers
353 views

Async insecurities

I feel like I'm overdoing the async await stuff. I'm just learning. Maybe this isn't the best instance to be using this stuff. I have a system with sensors that detect the completion of some action....
19
votes
2answers
248 views

RubberduckParser 2.0 - Asynchronous Parsing

The IRubberduckParser interface has seen breaking changes, and now looks like this: ...
0
votes
2answers
444 views

Async - await all the way

Related to this question (and even this Stack Overflow's one) I have been trying to avoid blocking the code. So what I understood it's that is preferable to make all the methods that rely on an async ...
1
vote
1answer
95 views

Change implementation from getting json from file to get it from API

I used to get a JSON file with some configuration settings from the file system, using this class: ...
1
vote
2answers
140 views

Running tasks in parallel

I've just started writing asynchronous methods for the first time having watched some tutorials. I have a method where I run two tasks in parallel (...
7
votes
1answer
375 views

Async Yield and continue on TaskPool

Using await task.ConfigureAwait(false) is a standard best practice for indicating to the compiler that the continuation does not need to be run on the current ...
0
votes
1answer
105 views

Calling synchronous code in asynchronous method

I'm implementing an interface with the async method Execute. In this I need to call some synchronous code. (removing an item from a dictionary). What would be the ...
0
votes
1answer
55 views

JW Player + Brightcove Integration

The following code gets video renditions from Brightcove using the media API. It then generates an ordered source list for the JW Player and selects the default rendition based on a pre-set bitrate. <...