Questions tagged [asynchronous-programming]
The asynchronous-programming tag has no summary.
185 questions
-1
votes
2
answers
158
views
Designing an application with safe paralleled tasking
The title may have been a little vague... I am working on a piece of software that is designed to perform one task. I would like this task to work in parallel, allowing for multiple asynchronous ...
1
vote
1
answer
745
views
Multi threaded and event driven [closed]
I got this problem in an interview and want to confirm multi threading adds no value here.
Case:
You are writing an agent to buy stocks.
The agent is initialized with a set of stocks to buy when ...
1
vote
1
answer
713
views
Need Async/Await equivalent for BackgroundWorker
Given the following code in the DoWork() event of a BackgroundWorker object, how can the concept be converted to the Async/Await model?
I wish to execute multiple downloads simultaneously in order to ...
0
votes
1
answer
171
views
What is the difference between running two blocks of code on the same thread and running them on two synchronous threads?
Suppose I have two blocks of code, A and B. A is to be executed before B. As I understand, I can do one of two things: 1) Put B in a separate thread that is to be executed after A's thread, or 2) Put ...
58
votes
8
answers
9k
views
Are events only used for GUI programming?
Are events only used for GUI programming?
How do you handle in normal backend programming when something happens to this other thing?
2
votes
2
answers
4k
views
Using asynchronous calls for heavy IO operation: How to prevent crushing the CPU?
I have an application that reads a large binary file (1GB on average) and compresses into a bzip2 archive. I started out at first compressing these files synchronously, as I didn't want to impede ...
22
votes
3
answers
9k
views
API Gateway (REST) + Event-Driven Microservices
I have a bunch of microservices whose functionality I expose through a REST API according to the API Gateway pattern. As these microservices are Spring Boot applications, I am using Spring AMQP to ...
4
votes
1
answer
1k
views
Using and designing asynchronous APIs with naturally synchronous parts
I've been programming for a long time, but very rarely with anything asynchronous (and not often with anything to do with multithreading, either).
Mostly for the fun of it, I'm writing a program to ...
0
votes
1
answer
627
views
Is there a ddd approach for sending events about embedded aggregate views
I'm investigating how we can notify UI/async clients (websocket) about an update which happened in an embedded view.
Let me elaborate...
We currently have a newsfeed where NewsItem is an aggregate ...
0
votes
0
answers
68
views
Handling error with Promise
I'm writing a small application in TypeScript that has to do some asynchronous operation and I'm doing it with Promise and async/await sugar. But my problem do not rely on the particular language or ...
0
votes
2
answers
886
views
Method to mask variable names in C++ files (cpp, h) and create an intermediate API?
I have a project which involves using C++ files along with an API on a local PC to communicate with a remote server app, and for sake of maintaining a semblance of non-disclosure with any hired ...
5
votes
1
answer
3k
views
Is there use case for implementing a callback if a future is returned?
If I have function which returns a future, is there any reason to also include a callback where the callback is simply called right before the future completes?
The only advantage I can think of ...
10
votes
1
answer
4k
views
"Reactive programming is programming with asynchronous data streams." is this true?
I was reading about Reactive programming, and came across this article The introduction to Reactive Programming you've been missing with the quote I put in the question title:
Reactive programming ...
0
votes
4
answers
2k
views
Callbacks without concurrency? [closed]
To sync on the terms I will first give my perspective on what a callback function in the simplest possible terms:
A callback function is a function that is executed as a response to a certain event ...
1
vote
3
answers
1k
views
Use case for async/await?
Background
Most of the applications that I write are hour long sequential tests for electronic equipment. The equipment under test has a specification that is a state-machine that looks like...
Get ...
3
votes
1
answer
578
views
Trying to understand some async/await behavior
I was working on a bit of code for a personal project, when I came upon the need to generate checksums on large amounts of files. First off let me say I already solved this problem ideally using ...
2
votes
3
answers
213
views
What is the right architecture for scalably scheduling and managing frequent periodic asynchronous?
I have built a setup which solves my problem, but I've pretty much just hacked it together by reading AWS docs and trying things out, so I want to see if there is a better way.
For the purpose of ...
1
vote
1
answer
2k
views
Async I/O operations - proper way to avoid deleting object
Using async I/O operations from boost::asio I often need shared pointers (and enable_shared_from_this and shared_from_this in callbacks) to avoid deleting objects too early. I think that it could be ...
3
votes
3
answers
14k
views
Writing new code in async but calling sync
I am writing some new code and would like to write it using async and await, but the calling code does not currently support async. Is it right to write the new code in async and call it sync until ...
-1
votes
1
answer
93
views
How to name functions which continue a process after an asynchronous step
Say that you have an web application which prints pages in a document. Suppose that after validating the page range, the application does the following:
If a billing option is turned on, it first ...
3
votes
1
answer
591
views
Would the APM be faster or more efficient than TAP?
I'm doing some research for a project in which I will need to create a service which can handle millions of requests per minute. Clearly I want to use an asynchronous programming model to make the ...
6
votes
2
answers
1k
views
Synchronous facade hiding asynchronous web service
I'm maintaining a system providing a typical synchronous web service REST API. It routes each request to one of several possible backend services. Now there is a new backend I want to use, but there ...
1
vote
1
answer
1k
views
HTTP Async/Await Task: avoid flooding server with requests?
I have a scenario where I have a Windows Store Application, there is a page with a search functionality, the user types names in a textbox and the app searches for names similar to the typed text.
...
1
vote
1
answer
2k
views
Is the logic behind `Asyncio.wait()` and async/await, the same, just the code is written differently (syntax)?
I'm learning Python, more specially parallel programming using Python Parallel Programming Cookbook by Giancarlo Zaccone.
At the time the book was published async/await was still in the beta version ...
99
votes
1
answer
64k
views
Is there really a fundamental difference between callbacks and Promises?
When doing single-threaded asynchronous programming, there are two main techniques that I'm familiar with. The most common one is using callbacks. That means passing to the function that acts ...
6
votes
1
answer
3k
views
UML: Should an asynchronous request-response message exchange be modelled as two ports/interfaces or one
I want to model an asynchronous request-response message exchange in UML.
The request is sent from a client to a server. The server responses asynchronously.
This can be modelled in a component ...
1
vote
1
answer
2k
views
Do any languages have syntax for promises? [closed]
I'm really glad that EcmaScript 6 has promises built into the language, but the syntax will still be quite wordy:
new Promise(f).then(r => {
...
}).then(r2 =>
...
}).catch(...
I'm just ...
6
votes
1
answer
1k
views
Best practice for parameters in asynchronous APIs in Java
Is there a best practice for using Guava's ListenableFuture in parameters in API calls? Compare these two versions of an interface that internally does a compare-and-set (I'm using Guava's ...
6
votes
1
answer
2k
views
How is one supposed to deal with the intermediate buffer of DataReader class?
Summary
I am developing a WAV file format reader under WinRT, and for this I need to read random amounts of structs consisting of fundamental types such as int, uint, float and so on.
Back in ...
2
votes
1
answer
1k
views
How should I handle the fetching of cached data in iOS
I'm developing an app at work, this is my first big application and in my smaller projects I didn't use caching at all.
What's currently happening
When the user logs on for their very first time ...
5
votes
1
answer
3k
views
C# async/await: Pedantry vs. the Debugger
I'm playing around with async and await, and they seem pretty intuitive, but some of the things I'm reading about these keywords doesn't make sense to me. In fact, some of it seems to me to be flat-...
24
votes
1
answer
10k
views
Does Akka obsolesce JMS/AMQP message brokers? [closed]
I spent the last week deep diving into the Akka docs and finally understand what actor systems are, and the problems that they solve.
My understanding (and experience with) traditional JMS/AMQP ...
2
votes
2
answers
3k
views
Reading using non-blocking IO on a fd asynchronously in C++ (moving from Node.js)
I'm trying to switch my brain from Node.js/Objective-C iOS programming to C++ programming, and it's a little bit taxing. Node.js and Objective-C with iOS do not have a run loop that I am supposed to ...
3
votes
1
answer
371
views
Connection between futures and exceptions?
Is there a connection between futures and exceptions? async-await looks very similar to throw-catch.
4
votes
2
answers
778
views
Async library guidance
I'm creating a library that contains a class that exposes several Async methods:
public class MyClass {
public async Task<Foo> DoFooAsync() { /*...*/ }
public async Task<Bar> ...
2
votes
1
answer
1k
views
JS Async: . Can I forget callbacks all together and replace with promises and/or generators [duplicate]
I've been using Nodejs and I really dislike callbacks (as i think most people do.)
I'm starting to learn about promises and generators. Both are a lot cleaner and I'd like to forget the horrors of ...
1
vote
1
answer
796
views
Mixing reactive programming with non-reactive return requirements
Variable context from an initial non-reactive caller
The whole application cannot be reactive i.e. this method needs to return a result here
public string GetTextOfInterest()
{
var ...
4
votes
3
answers
7k
views
Blocking function call with asynchronous content
I am sure that this is a common design pattern, but I seem to have a blind-spot.
I have a requirement that the function call from Application to Service be blocking, but service needs to do something ...
9
votes
1
answer
1k
views
When asynchronous tasks make a bad UX
I'm writing a COM add-in that's extending an IDE that desperately needs it. There are many features involved, but let's narrow it down to 2 for the sake of this post:
There's a Code Explorer ...
1
vote
1
answer
196
views
Equivalent translation of Asynchronous behaviour in C
As a follow-up to my other question, if one were to build a general-purpose translator from a language that has support (be it with an external library or otherwise) for asynchronous behaviour to a ...
5
votes
1
answer
8k
views
Implementation of Asynchronous function call in C
I took it upon myself recently to work towards making a general-purpose Translator to automatically translate js programs into C, but I got stuck when thinking of asynchronous behaviour. Using ANSI / ...
1
vote
1
answer
2k
views
C#/.NET multithreaded application design
The application to be designed serves as a bridge between two different systems.
One natively speaks TCP (RS232 actually, but there's a COM->ETH server in the line of communication) - the other one is ...
-4
votes
1
answer
1k
views
using node.js server with mysql-module and PHP for a penny-auction website? [closed]
I'm building a penny-auction platform like DealDash and just read into the WebSocket and node.js topic.
I used PHP, MySQL and Ajax to build the website. I'm nearly finished and just have to implement ...
8
votes
1
answer
596
views
Language compiled to JS – most elegant way to do synchronous-style waits
I'm trying to make (yet another) language that compiles to JavaScript. One of the features I'd like to have is the ability to perform JavaScript's async operations synchronously (not exactly ...
0
votes
1
answer
404
views
Can you refer to the callback function as an API?
A system design is decoupled into two layers say layer A and layer B.
The interaction between layer A and layer B occurs through an interface that is exposed by layer B in form of an API. This ...
1
vote
1
answer
7k
views
Using $timeout to normalize response time of a webservice call (Best practice question)
Consider you have a simple, standard $http request to a REST api:
...
function makeCall() {
var restURL = "http://my-rest-api/endpoint";
return $http.get(restURL);
}
...
If the execution time ...
2
votes
1
answer
958
views
Experiences with C++ Async/actor model Library [closed]
I am fairly experienced with async and concurrent programming in c# using event, actor, and task based patterns, but now I have a task in c++ with which I have basic familiarity and it needs some ...
2
votes
1
answer
178
views
What are the underlying patterns in systems allowing asynchronous operations?
Say I'm working with a system that allows async, nonblocking operations. If I queue up a set of those operations and specify their result buffer references:
nonblocking_write( message, write_buffer )...
0
votes
2
answers
272
views
When are nonblocking read or receive operations useful?
Regardless of library, language, or spec, asynchronous send/write operations make sense to me, because code later in the execution path may not have any dependency upon the success or failure of the ...
2
votes
2
answers
2k
views
Observer pattern: Prevent multiple firings on changed internal property
I have an object Foo that has 2 public properties: A and B.
These properties can be changed from outside, as the application I'm working on is using a data-binding architecture. This is the front-...