Questions tagged [asynchronous]

Asynchronous programming is simply allowing some portions of code to be executed on separate threads. It makes your applications perform better, be more responsive, and use the resources of the system they are running on to the fullest extent.

Filter by
Sorted by
Tagged with
10 votes
1 answer
162 views

Wordcloud from all answers of a user here on CR

Since I haven't really used Python's new async features yet, I took some older code of mine, which took all of my answers here on Code Review and generated a word cloud from them, and updated it to ...
Graipher's user avatar
  • 40.8k
6 votes
2 answers
759 views

Buffering of fast changing datapoints or events

The following class implements a buffer which captures fast changing datapoints or frequently raised events and dispatches them in batches. It will asynchronously call a processing function for the ...
ChrisWue's user avatar
  • 20.3k
32 votes
2 answers
485 views

Script to enter text in a box

Here's a little script that enters text into a document when activated. ...
hairboat's user avatar
  • 421
13 votes
2 answers
10k 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 ...
Mathieu Guindon's user avatar
8 votes
3 answers
2k views

Simplifying asynchronous "executeAsync" method along with "onFailure" callback

I have a system in which user id is "sharded" across all the machines which means each machine is responsible for certain user id data. I am working on a library which will take ...
david's user avatar
  • 1,647
7 votes
2 answers
20k views

Using SendAsync to send multiple emails

My method for sending emails with Send() is getting very slow when I send more than ten messages. Sample 1 (1 sec) 2 (2 sec) 3 (4 sec) 4 (8 sec) and so on... so I ...
Dwza's user avatar
  • 181
7 votes
1 answer
1k views

Lock Using “Interlocked” vs lock Statement (“Monitor”) (Followup)

This is a followup to a previous question. Considering: Interlocked.CompareExchange generates a memory barrier, Intended to be used with very fast operations (...
Kaveh Shahbazian's user avatar
7 votes
1 answer
371 views

AutoResetEventAsync, am I missing something?

So I wrote an asynchronous version of AutoResetEvent: ...
SHSE's user avatar
  • 223
7 votes
2 answers
11k views

File Async writer using Tasks or new features of .Net 4.5?

This code was posted as answer to Async file writer in .Net 3.5. How would it be done better using Tasks or new features in .Net 4.5? ...
jimjim's user avatar
  • 301
7 votes
1 answer
1k views

C++: algorithm that uses fixed-size buffer of data that are produced in stream, faster than the algorithm speed

I try to implement this scenario with a producer/consumer multithread pattern and I'd like to optimize synchronization and memory model directive used. This code originates from a SO question and its ...
Oersted's user avatar
  • 299
6 votes
1 answer
150 views

C# asynchronous notification vector

The purpose of this class is to efficiently notify another thread when data is available with minimal blocking to access/pass the data. The data reader/producer thread processes data in bulk which ...
sfanjoy's user avatar
  • 233
6 votes
2 answers
1k views

Async File Input

I recently started work on my own Async file input "library" in C++. I got it done today and I decided to put it on Code Review to see how well I actually did, and where I can still improve the code. ...
MivVG's user avatar
  • 205
6 votes
2 answers
7k views

Lock Using "Interlocked" vs lock Statement ("Monitor")

A followup question can be found here, based on this question and it's answer. Considering: Interlocked.CompareExchange generates a memory barrier, Intended to be ...
Kaveh Shahbazian's user avatar
6 votes
1 answer
7k views

Class for easier to read IProgress<Class> handling

The recommended way to report something as "progress" back from a async function is to use IProgress<Type> or ...
Tex Hex's user avatar
  • 185
5 votes
2 answers
721 views

Asynchronous HTTP JSON request

For asynchronous requests, I use Alamofire. I have created one method for requesting async data. ...
saurabh's user avatar
  • 156
5 votes
2 answers
127 views

Get files downloaded asynchronously after double clicking on list item (C++)

The problem I am trying to solve as an exercise is as follows: I have a UI running in the main thread, specifically a list view with many items. Each item represents a file that the user can download....
M. Saintourens's user avatar
5 votes
2 answers
17k views

Implementation of an asynchronous TCP/UDP server

I am trying to implement a TCP/UDP server so all I have to do is something like this: ...
Stuart Blackler's user avatar
4 votes
2 answers
6k views

Async file writer in .Net 3.5

I'm curious what people think about this little bit of logging code. It seems to work ok. Is there anything I'm missing? ...
jeremywho's user avatar
  • 253
4 votes
1 answer
164 views

Implementing `Promise.all()`

I took a stab at implementing Promise.all(): ...
Tobi Alafin's user avatar
  • 1,806
4 votes
1 answer
16k 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 ...
Lost_In_Library's user avatar
4 votes
1 answer
267 views

General Retry Strategy #2

Previous version Now supports async operations and cancellation. Let’s say we copy some file using retry strategy (it might be blocked, etc.). App code comes bellow: ...
Dmitry Nogin's user avatar
  • 6,133
3 votes
1 answer
6k views

Simple multi-client echo server

I've been looking at some async comms in C#. As a proof of concept, I've written a simple multi-client echo server. The server allows multiple TCP clients to connect and listens for input from the ...
forsvarir's user avatar
  • 11.6k
3 votes
1 answer
2k views

Concurrent fire and forget async task queue

I had to do a lot of IO stuff on my server running Node JS where I did not really care about the result of the operations. The list of incoming tasks could be huge, so I had to limit the number of ...
Endauriel's user avatar
  • 153
3 votes
2 answers
824 views

Blocking call to an async function

While migrating to structured concurrency it may be sometimes convenient to temporarily make a blocking call to an async function - e.g.: ...
Milos's user avatar
  • 619
1 vote
1 answer
172 views

ThreadSafe IsoStorageManager

This is a continuation of the last thread. I wanted to add a thread-safety and I was considering AwaitableCriticalSection and Task+Mutex. I ended up with mutex; it can be a bit slower but it would ...
Vitalii Vasylenko's user avatar
1 vote
0 answers
71 views

C# asynchronous notification vector v2

As a result of my previous post, I have implemented / refactored my code and have started making successful use of my class. However I have come across a couple of new questions: The observer must ...
sfanjoy's user avatar
  • 233
1 vote
1 answer
247 views

C# asynchronous tasks training (turn-based simulation)

I know embarassingly little about asynchronous programming in C#, so decided to start catching up. It would help me a lot if anyone checked this basic example I've created. Assumption: we're creating ...
BFyre's user avatar
  • 113
1 vote
1 answer
344 views

Simple PacketHandler class [closed]

I can recently coded an emulation system and in this project I have a PacketHandler for each player connected to a socket server, and each player receives packets (data) from the client application. ...
Liam's user avatar
  • 87
1 vote
1 answer
478 views

Concurrent Task Waiter

I have some code designed to simplify managing multiple asynchronous operations. The code creates callback actions that, when executed by the asynchronous operation, track which asynchronous methods ...
Nick Udell's user avatar
  • 5,197
0 votes
1 answer
1k views

Using asyncio and aiohttp in classes

To better familiarize with async requests I wrote a very simple scraper that relies on aiohttp to retrieve some basic information from the product page (product ...
anddt's user avatar
  • 195