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.
520
questions
39
votes
2
answers
14k
views
A new approach to multithreading in Excel
Intro
Multithreading tools exist in Excel - often to run macros in multiple instances of Excel, or to convert macros to vbscripts that can run independently. However I've often come across projects ...
36
votes
2
answers
6k
views
Asynchronous network callback code
I did not get the job after submitting this piece of work in an interview, but I have no feedback to know what "BAD" things are inside this block of code.
The requirements are:
Connect to the ...
32
votes
2
answers
490
views
Script to enter text in a box
Here's a little script that enters text into a document when activated.
...
25
votes
2
answers
30k
views
Real World Async and Await Code Example
I have been looking everywhere to find good real world examples of the new Async and Await features in .net 4.5. I have come up with the following code to download a list of files and limit the number ...
24
votes
3
answers
12k
views
Synchronous / asynchronous REST client
I have working code with original design, and now I had a slight design change so trying to code review that as well. I already had code review on my original design here.
Original Design:
I am ...
22
votes
1
answer
15k
views
Simple Async Google Maps initializer with AngularJS
Here is a simple reusable AngularJS factory I came up with to initialize Google Maps Asynchronously, which somehow does not seem ...
15
votes
3
answers
15k
views
Verifying the type of an AggregateException's inner exception in a unit test
I've got the following code inside an integration test.
...
15
votes
1
answer
7k
views
What is better for Lazy-Loading Navigation Properties of detached Self-Tracking Entities through a WCF service?
I have a WCF client which passes Self-Tracking Entities to a WPF application built with MVVM. The application itself has a dynamic interface. Users can select which objects they want visible in their ...
14
votes
1
answer
19k
views
Asynchronous TCP server
After some investigation, I implemented an asynchronous TCP server as per the following example. During my investigation I was unable to find an example that cleanly shuts down the server; after some ...
14
votes
2
answers
5k
views
Asynchronous Circular Buffer in C#
Preamble
I want to be able to test methods which communicate over a simple exclusively asynchronous two-way stream-like interface which may underneath use any of a number of communication methods (e....
14
votes
1
answer
14k
views
A ViewModel using ReactiveUI 6 that loads and sends data
Most of the Rx Compelling Examples™ load and store data locally, which I don't find that Compelling.
I spent some time coming up with how to best perform the following actions but want to make sure I ...
14
votes
2
answers
7k
views
Implementation of Asynchronous Cache
I have been attempting to implement a cache which caches the results of an asynchronous method, with the restriction that I only want that method to run once for any particular item in the cache. Many ...
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 ...
12
votes
1
answer
10k
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 ...
12
votes
1
answer
15k
views
Continuously receive messages async from Azure Service Bus Queues
I'd like to get input on my approach of continuously receiving messages from an Azure Service Bus queue using the async part of the library.
My main concern being whether its "safe" to use Task....
11
votes
2
answers
10k
views
Having sync and async methods by implementing future interface
I need to make a library in which I will have synchronous and asynchronous methods in it and this library will be used by our customer in our company. Some customer will call the ...
10
votes
2
answers
66k
views
TCP async socket server client communication
I develop my first async TCP socket server and client program in c# and would like to review the first parts of it. I like to get some information’s about smelly code that I missed and what I could ...
10
votes
1
answer
49k
views
Correct approach to wait for multiple async methods to complete
I have an IWorkflow interface defined as follows:
...
10
votes
2
answers
2k
views
Am I overlooking anything with this asynchronous read/write loop?
Here's my code:
...
10
votes
1
answer
166
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 ...
10
votes
2
answers
9k
views
Chaining asynchronous tasks that must run sequentially
I want to implement an Agent-like object in C#. An Agent wraps some memory location (ideally storing an immutable object) and receives updates to that location. All ...
10
votes
2
answers
6k
views
Echo server with CompletableFuture
I recently wrote a simple echo server in Java 7 using the NIO APIs so it was asynchronous and non-blocking. Then I decided, as a learning experience, to redo it with Java 8 hoping to use a more ...
10
votes
1
answer
160
views
Simple concurrency implemented in Python
Purpose of the question: learn more about ways to implement concurrency in Python / experimenting.
Context: I want to count all of the words in all of the files that match a particular pattern. The ...
10
votes
1
answer
298
views
Lightweight asynchronous event library in C - Threadpool module
I have finished writing a C library whose purpose is to provide a simple API for asynchronously executing functions, waiting for events on file descriptors and waiting for timeouts. The whole library ...
10
votes
1
answer
6k
views
Node.js parallel file download, the ES6 way
I wrote a script that downloads all PDFs found on the web page of a particular government agency. I would have chosen bash for such a task, but I want the script to ...
9
votes
3
answers
11k
views
Implementing an asynchronous mutex in C#
I wrote a simple synchronization primitive that I can use with async operations on an external REST service so that I don't call it twice from different threads and have one call fail due to not ...
9
votes
3
answers
35k
views
Running 2 sets of tasks at the same time
Currently, my team and I have 2 types of databases that are updated periodically, SQL Server and Access. Also, we run specialized reports based on those databases.
Basically, we have 4 tasks that ...
9
votes
2
answers
3k
views
Non-blocking, non-threaded HTTP client implementation
This is a C# WinForms program targeting .Net 4.5. I am using it for a movie organizer application that will contact sites like OMDB, MyApiFilms, etc. for data about the movies. At the main application ...
9
votes
1
answer
427
views
Operation cancellation
Brevity is for kings as it requires context and context is for kings. Me.
GitHub and NuGet
How many times you have been writing something like this passing those tedious logger/token parameters?
<...
9
votes
1
answer
13k
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 ...
9
votes
1
answer
2k
views
Asynchronous Array.map
I put together an asynchronous map function for Swift's Array using Grand Central Dispatch. It's called with a transform closure,...
9
votes
1
answer
2k
views
WCF using TAP without worrying about timeouts
I really like using the new TAP pattern in .Net 4.5. and I am updating some of my older projects to use it.
One of my old patterns was to use EAP with WCF so I could have functions that could take ...
8
votes
3
answers
185
views
Asynchronous Code Inspections
Rubberduck code inspections can take quite a while to complete, so I decided to run them on a background thread instead of locking up the IDE. The only drawback is... the IDE isn't locked-up while ...
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 ...
8
votes
1
answer
1k
views
Generic asynchronous SQLite search builder
I am writing a database manager that reads and writes to a local SQLite database on a mobile device. It works pretty well for the most part, but read access is somewhat slow - it takes about 2-5 ...
8
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 ...
8
votes
2
answers
443
views
Concurrent Task Waiter 2
This is an iteration of my previous question: Concurrent Task Waiter
Summary from before:
I have some code designed to simplify managing multiple asynchronous
operations. The code creates ...
8
votes
2
answers
44k
views
Wait until all files are loaded asynchronously, then run code
I'm an experienced programmer but not too great at JavaScript so I'm looking to see if I'm doing this 'right'. I want to have several files loaded in (Ajax or really AJAJ) and, once loaded, run some ...
8
votes
1
answer
20k
views
Async friendly Timer
I'm trying to implement a Timer that schedule an async action with the following requirements:
thread safe
only one action should be running at any given time (period countdown should start when the ...
8
votes
3
answers
24k
views
Complete async OpenSSL example
I am trying to create a fully async example of a client and server using SSL.
I think these are the required assumptions:
Connecting may require socket readability and writeability notifications.
...
8
votes
4
answers
6k
views
Code works but memory usage is erratic
I have the following class which is a tool for retrieving MD5 hashes of files that are input into it. They can potentially be very large files and I require cancellation and progress report, hence why ...
8
votes
3
answers
686
views
Node.js module using Promises (client for KeePassHttp)
This is my first Node module, as well as the first time using Promises in Javascript. It is a client for the KeePass plugin "KeePassHTTP" to expose passwords securely, which I am planning on using to ...
8
votes
2
answers
5k
views
A blocking buffer manager to provide segments of a byte array
Since asynchronous operations (like Socket's Begin*-End* pairs and ...
8
votes
1
answer
3k
views
C# Async Socket Wrapper
I'd like to get a little feedback on this async socket wrapper. My goal is to merge socket Begin/End methods into a single async call. I also wanted to wrap exceptions so they are easier to handle in ...
8
votes
1
answer
439
views
Dining Philosophers Problem in Clojure
I have implemented the Dining Philosophers Problem in Clojure with refs, trying to emphasize readability. Please point out if parts of it are inefficient, not idiomatic, or improvable in any way. Full ...
8
votes
1
answer
4k
views
Web Scraping with Python + asyncio
I've been working at speeding up my web scraping with the asyncio library. I have a working solution, but am unsure as to how pythonic it is or if I am properly ...
8
votes
1
answer
466
views
Using Delegates and BeginInvoke with .NET 2.0 WebServices
I'm attempting to implement a simple long-polling/comet/reverse AJAX solution, and came across the concept of delegates, specifically with the BeginInvoke and ...
8
votes
1
answer
3k
views
Questions regarding the use of Requests Futures for accessing REST URLs
This is a much simplified version of the real code focusing just on the handling of Futures from Requests Futures.
I have a few questions:
I had to implement my own version of ...
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?
...
7
votes
2
answers
471
views
Action queue manager to perform action in a FIFO fashion
Recently, I needed a class that could execute code in a FIFO fashion in order to update parts of a WinForms or WPF UI which did not block the UI Thread and left the UI responsive to any interaction ...