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.

learn more… | top users | synonyms (1)

-5
votes
0answers
28 views

Optimise async functions with nested callbacks while using retry pattern [closed]

I am currently reading some really annoying code. It's basically some weird asynchronous functions with nested lambda/callbacks, and there are some retry pattern involved too. Although I can ...
0
votes
0answers
40 views

Open and read a large number of files from folder [duplicate]

Is this the fastest way to open a large number of files and read their contents? (The folder may contain lakhs of files.) ...
4
votes
2answers
81 views

C++ Wrapper for cURL: Multithreading and serializing asynchronous ops

I did this library to help me from one of my projects and decided to publish it on GitHub hoping people might find it useful, convenient and easy to use in their projects too. It's a header-only ...
3
votes
1answer
56 views

Creating new async tasks

In the past, I have used AsyncTasks to perform network requests for my Android app. I recently switched to RxJava to be able to cancel the requests when the user exits an activity. I have created a ...
2
votes
2answers
60 views

Property value from an asynchronous operation

I have an app which has a session mechanism. When a user creates an account in the app initially, the API returns an access token, the expiry date of that access token and a refresh token which can be ...
5
votes
1answer
286 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 ...
2
votes
0answers
26 views

Multithreaded Monte Carlo pi approximation with own pseudorandom number generator - follow up

This is a follow up of the question I posted previously here. I made some changes, based in the answer by MikeMB, making use of asynchronous calls (with std::async ...
6
votes
2answers
117 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) ...
0
votes
0answers
40 views

Chainable futures in Python

Here is a homemade Future class: ...
2
votes
1answer
12 views

Making the basic accumulator in Real World OCaml use Async

I was going through Real World OCaml and wanted to make the program in "A Complete Program" use Async. It works now, but I'm wondering how idiomatic it is, and if I'...
1
vote
0answers
31 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 ...
5
votes
1answer
149 views

HTTP downloader using Beast

I have written a small HTTP downloader using boost::asio Beast library (proposed to be included in Boost) network::uri library ...
2
votes
1answer
119 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 ...
2
votes
1answer
41 views

Threaded and asyncio API library

In Python I am trying to create an API for a connected device. I want to be available for both threaded (using request) and async applications (using aiohttp). What I've come up with is wrapping the ...
3
votes
0answers
48 views

Converting MongoDB's IAsyncCursor(Source) into an Rx Observable Sequence

I've been toying with this idea for quite a while. Needless to say that this really enables a lot of possibilities, Especially when combined with a SignalR Backend. Added below is what I came up with....
2
votes
2answers
84 views

Calculating Pi with Android

I'm kind of new to Java but I am writing an Android app. Right now I'm working on an async task to calculate Pi but when I run it the memory usage increases alarmingly (+5MB per second). This one ...
0
votes
1answer
37 views

Async TCP connection that handles reading and writing

My situation is as such: I must connect to a server via TCP, at the end of the session (several hours), they will close the connection - throwing an exception that should be gracefully handled I need ...
3
votes
0answers
47 views

Daemonizing shell scripts - MqSH

This is an mqtt driven, interactive, and asynchronous remote shell daemon written in bash. I call it "MqSH" or simply "mq". It works with bash, the busybox ash shell, and perhaps other Bourne-like ...
3
votes
0answers
40 views

Reading log file of subprocess

I run subprocesses with lot of output (compilation of Unity 3D projects). I use log parsers to find known issues. ...
0
votes
1answer
118 views

Simple PacketHandler class

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. ...
2
votes
0answers
44 views

Waiting for all task to complete while catching exceptions early

I'm working on simulating a number of processing elements (nodes) which do some work in parallel and communicate by exchanging messages. The message exchange is not in the scope of this post, but it ...
1
vote
1answer
54 views

A Simple Async Task in Clojure

Purpose of Code: To simulate scraping the web and updating a db, by, presently, adding randomly generated numbers to a "database". Have I wired up the followin async code properly? Is there a simpler,...
0
votes
1answer
108 views

HttpRequest class using AsyncTask for Android application

I am using the following class to retrieve a http response, which contains data for my Android App. Everything works fine, but there is a performance issue. I get the following warning when requesting ...
2
votes
0answers
44 views

Timeline request function for Twitter bot

I'm writing a Twitter™ bot for the Retrocomputing Stack Exchange site using JavaScript. To ensure that it doesn't tweet about the same question twice in a row, I request the account's timeline. ...
3
votes
1answer
141 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: ...
2
votes
0answers
70 views

Handling async in Clojure

I've defined myself a function for caching requests and their responses in a browser environment; I'm using ClojureScript. ...
4
votes
1answer
117 views

Asynchronous database query system using futures-rs in Rust

Background I've been working on an algorithmic trading platform in Rust and utilizing the newly released futures-rs library to keep everything asynchronous and non-blocking. One issue I've come ...
0
votes
0answers
87 views

Download of files in Async task for Android

I am using AsyncTask in Android to download files from the server. Is there a way by which I can improve the process? Can the download happen any faster? Is there a ...
3
votes
1answer
45 views

Make one greenlet tell another to shutdown

I am building a commandline app to check proxies, which has a daemon flag (running forever or just once). There are producers, checkers and storers. I want them to run in parallel and be able to ...
2
votes
1answer
78 views

99 simple asynchronous bottles on the wall

I have some basic code which registers functions, with given variables, to be executed after a certain time has elapsed. I will roll this code into my software project when it is ready. If it works it ...
0
votes
0answers
35 views

Factory for ListenableFutureCallbak

I'm developing a Rest API, and at the moment i have a bunch of controllers like this one: ...
1
vote
0answers
487 views

Handling Firebase's asynchronous calls Android

I have written a helper class to manage callbacks from Firebase's asynchronous calls. Can this be implemented in a better way? ...
4
votes
1answer
66 views

Asynchronous task execution using actor based concurrency

I have a program where I need to implement asynchronous tasks (writing a directory to a file following any change to the directory). There is existing documentation within my organization for ...
3
votes
1answer
71 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 ...
2
votes
1answer
102 views

WPF Mvvm async function ViewModel

I worried about this code in a ViewModel. ViewModel should not contain any code except binding's. But without async update the ui would freeze. How do I improve it? I'm restricted to using .net 3.5 or ...
5
votes
1answer
58 views

Async.sequence implementation

I have a simple implementation for "Async.sequence" (the name came from here), but I would like someone to review it for performance, tail call optimization, and ...
2
votes
2answers
67 views

Reading genetic data in VCF and Tabix formats using an asynchronous library

I'm working with an open-source library for processing and parsing genetic data in VCF and Tabix formats. It contains functions and classes that make it easy to read an index file (a Tabix) and load ...
7
votes
1answer
154 views

Make Simultaneous HTTP Requests That Resolve Into a Single Return

This week, in an ongoing job search, I was tasked with the following pre-screening question: Make two simultaneous http requests. Use the language and library of your choice. Make sure the results ...
2
votes
1answer
96 views

Android network API request

I often use a similar scheme work with an API project. Can it be made easier, or is there a standard approach? This class creates an API request: ...
-1
votes
1answer
1k views

Synchronous loop with internal asynchronous calls

Below I've written a simple version of what I'm attempting to accomplish. I'm new to asynchronous functions, so it's difficult to wrap my head around this. My goal is to wait for the loop to finish ...
2
votes
1answer
206 views

Retrieving the lotto numbers - Node.js

I'm looking for feedback as to how I've structured the async calls, and If anything should be written differently. endpoints.js ...
1
vote
2answers
50 views

Using promises to GET and process data

I'm working on a Meteor application which integrates a user's contacts from external sources (Google in the case of this example). I'm currently writing the server side code to retrieve this data and ...
0
votes
0answers
58 views

Register a node-client code through an API call efficiently?

I've got a node_module that reads ArcValues for a user and updates the config of the node client at user's local (root). Like so: ...
2
votes
0answers
57 views

API design for loading OpenGL textures asynchronously

What do you think about this API for loading OpenGL textures asynchronously? My main concern is that the loader class executes code on the client io_service. This takes away some control from the ...
3
votes
1answer
46 views

Retrieving the Currently Logged in User's Department

I hope this is the right place for this. I basically wrote the below script for a SharePoint 2013 where I needed to get the department of the currently logged in user. I was finally able to get it ...
3
votes
2answers
62 views

Async Implementation

I'm seeking code review comments for the following implementation. jsFiddle ...
1
vote
1answer
111 views

Composing IO and Async in haskell

Whether based on MVar or TVar, async implementation are always based on operation on some underlying monad IO and STM. Making Async a monad on its own, as in F# async computation builder, if done in ...
4
votes
1answer
131 views

TryRetry - Try, Catch, then Retry

I have created a class to try, catch and retry N times. My class also supports retrying asynchronously. I'm wondering if there are better ways to implement this. I'm most concerned with the ...
1
vote
1answer
137 views

Implementation of API to create a company account in a database

I'm working on an API that has a lot of controller functions like this: ...
6
votes
1answer
508 views

Login UI for an Android app

This code starts a new thread for login and reacts according to the JSON result returned by the server. I think this code has too many conditionals, exception handlers, and nested functions. ...