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

2
votes
0answers
11 views

Refactoring asynchronous JS pre-rendering code

A few months ago I wrote this module but, coming back to it, I find it a bit hard to read and reason about. I want to ask community's opinion on whether this needs to be refactored, and how I could ...
0
votes
0answers
15 views

Limiting Q promise concurrency in JavaScript

I wrote a helper to limit Q promise concurrency. If I have a promise-returning function promiseSomething, writing promiseSomething = PromiseScheduler.limitConcurrency(promiseSomething, 5); ensures ...
3
votes
1answer
69 views

Node.js Async Callback Hell

Attempting to create a final array with data pulled from 3 functions. The first two functions have all the data but then the 3rd function needs to run looping through one of the fields from function 2 ...
2
votes
1answer
41 views

Generic Task Progress Dialog

I'm attempting to write a Progress Dialog that I can instantiate, show and then pass a task to complete to. I'm pretty new to Task Based Patterns, so please bear with me. Ideally my goal is to be ...
4
votes
1answer
80 views

simple ThreadPool implementations

I would like to ask you for a code review of my c++11 Thread Pool implementation. Your constructive criticism is welcome! Could you give me some ideas how to extend it? The main idea is to ...
6
votes
3answers
197 views

“Proper” Asynchronous implementation

I need some opinion if my code below is proper for an async process. This code only reformats text. Please let me know if this implementation is not proper or needs some improvement. static void ...
3
votes
1answer
51 views

AsyncTask for handling server api calls

Got this design for getting rid of checking network availability and informing user of errors. Is it good at all? Please, help. Overall point is to fire server call as short as possible: new ...
1
vote
1answer
45 views

Node.js DynamoDB callback

I am writing an API which gets results from a DynamoDB table and puts the JSON back into the browser. The code below works and returns the desired results. However, after reading about async and ...
2
votes
0answers
49 views

Am I using Q the right way or is there a better way to do what I'm doing?

I'm using Q to flatten out some callbacks in my unit tests and return a promise to mocha (which knows to wait until the promise is resolved before running the next test). Originally I had this code: ...
2
votes
1answer
157 views

DAL Efficiency Help

I am attempting my first try at some c#. So far I love it, (not more than vb tho ;)) however, I am wondering if I can make these classes a bit more efficient. Please note ###Test is my attempts at ...
1
vote
2answers
188 views

Static classes, singleton and thread-safety

I have a classes for work with a web service (Windows Phone 8 app). I will briefly describe what doing each. My main question is the thread-safety of the solutions. I think there will be problems ...
2
votes
2answers
211 views

Timer factory fn optimization

I use this Timer function quite a bit lately for all sorts of stuff, and would appreciate if someone could review/analize/criticize/verify and, of course, suggest things I can do to optimize it for ...
1
vote
0answers
251 views

Javascript Queue for async functions

Based on the answer to my previous question on Stack Overflow, I put together the following Queue class. I realize there are already libraries out there to do this. However, I wanted to actually ...
1
vote
1answer
76 views

Node.js/javascript: synchronizing async tasks

Yes, I know there are plenty of libraries to get this done (Q, step, async), but only for learning I'm wondering if the following code is ok and usable or have major drawbacks and it is only usable at ...
1
vote
0answers
235 views

Asynchronous Server Sockets - Thread-Safety/Performance (MMO Gaming)

I'm writing this game server for my small 2D MMO game. So here are my questions: What do you think about the Thread-Safety of the code? Please explain how can it be made thread-safe / show example/ ...
0
votes
0answers
189 views

Is this factory method a good approach?

We are beginning to learn Node.js and we are not always sure if we do it the right way. We have a strong object oriented background so the adoption is not always easy. Right now we implemented a ...
1
vote
2answers
49 views

functional javascript - how could I generalize this code that correlates parallel async requests with their results?

/** * takes a list of componentIDs to load, relative to componentRoot * returns a promise to the map of (ComponentID -> componentCfg) */ function asyncLoadComponents (componentRoot, components) ...
1
vote
0answers
304 views

WCF using TAP without worrying about timeouts

I am really liking using the new TAP pattern in .net 4.5. And am updating some of my older projects to use it. One of the old patterns I used to use was to use EAP with WCF so I could have functions ...
4
votes
2answers
4k views

TCP async socket server client communication feedback and review

I develop my first asyn 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 ...
1
vote
2answers
426 views

Asynchronous version of AutoResetEvent

This is my second attempt to create asynchronous version of AutoResetEvent. At first I tried to make it completely lock-less, but it turned out to be impossible. This implementation contains a lock ...
6
votes
1answer
137 views

AutoResetEventAsync, am I missing something?

So I wrote an asynchronous version of AutoResetEvent: public sealed class AutoResetEventAsync { private readonly Task<bool> falseResult = Task.FromResult(false); private readonly ...
1
vote
1answer
646 views

Simple Telnet Chat Server nodejs (correct way to write programs in node.js (asynchronous programming model))

I am new to node.js and asynchronous programming and this is my first small project to learn it. I have written a small Telnet Chat server and the program works but I want to know if this is the ...
2
votes
1answer
151 views

Am I using async C# correctly?

I have the following bit of code the calls out to two different command line components (each wrapped in their own Task) public async Task<FileInfo> RasterizeAllPdfs(IEnumerable<Uri> ...
2
votes
1answer
2k views

Use and Understanding of async/await in .NET 4.5 +

All, please take the following example code CancellationTokenSource cancelSource; // Mark the event handler with async so you can use await in it. private async void StartButton_Click(object ...
1
vote
1answer
582 views

TPL Thread Leak and Memory Leak

I'm trying to track down what I suppose to be memory/thread leak in one of my programs. My program uses a function to upload a file to a Windows Azure Storage Blob. In order to make this function ...
0
votes
1answer
85 views

Perfomance and Other Improvements

I am trying to wrap my arms around all the digital files we have, so I thought I would organize all of our pictures and videos into folders named after dates. I'm learning F#, and this felt like a ...
2
votes
1answer
278 views

Putting called delegate into AsyncState parameter - Pros/cons?

I have the following interface: public interface ILogger { void Log(string message, string title, StatusType type, DateTime timestamp); IAsyncResult LogAsync(string message, string title, ...
2
votes
1answer
2k views

Correct approach to wait for multiple async methods to complete

I have an IWorkflow interface defined as follows: public interface IWorkflow { Task ConfigureAsync(); Task StartAsync(); Task StopAsync(); } And I have an Engine class: public sealed ...
2
votes
3answers
196 views

(async) Task “Keeper” for keeping the “fresh” data - How do I improve this?

Background I retrieve data from a 3rd party API, over HTTP. It's often slow, and sometimes just fails. I needed a class that would keep getting data from that source, and keep it in memory. So, ...
1
vote
0answers
134 views

MixpanelAPI - my first open source project

I would love to hear feedback on my first open source project (a very simple async API for Mixpanel) It implements a REST client for this REST HTTP API Review requested on the following aspects: ...
2
votes
3answers
243 views

Polling a email using async / await

I've created a create a console app that would: Call a method to check an email account (I've done this step) Convert the attachment to pdf (I've done this step) Then once the conversion is complete ...
3
votes
1answer
226 views

Interview example [closed]

Recently I participated in an interview for a Russian company in Moskow and could not answer some of the simple questions. One of them I would like to ask here. List all problems which you can see in ...
7
votes
2answers
3k 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 ...
1
vote
1answer
157 views

Calling a function when all asynchronous calls complete

Below is a simplified version of some code I am using to execute a function after all asynchronous calls complete. Is this a reasonable piece of code? It seems to work. Nothing would break if ...
5
votes
1answer
878 views

A blocking buffer manager to provide segments of a byte array

Since asynchronous operations (like Socket's Begin*-End* pairs and *Async methods) that use IOCP under the hood cause the byte array that you use as buffer to be pinned in the memory. So if you ...
4
votes
0answers
480 views

Asynchronous leadership election

The following code should be mostly OK, but I'm trying to avoid any stylistic problems or find anything that I overlooked. The code is an implementation of asynchronous leadership election on a one ...
0
votes
1answer
41 views

Processing a collection of objects, one at a time, with an asynchronous method.

I currently use setInterval and a wait flag to process this collection. Is there a cleaner way? var wait = false; var processInterval = setInterval(function(){ if(!wait){ var currentVideo ...
8
votes
4answers
764 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 ...
3
votes
2answers
716 views

“Singleton” task running - using Tasks/await - peer review/challenge

My app saves data to a file - I obviously don't want the app to write to the file from multiple locations on disk. What I want is a generic "utility" class that will know how to run a piece of code ...
4
votes
1answer
160 views

Please review this implementation of a custom function extending jQuery.Deferred

I couldn't find an example on how to have a custom function inherit jQuery's functions while leaving the original jQuery function I'm inheriting from unchanged (I wanted my function to have a read but ...
2
votes
2answers
312 views

simple stupid F# async telnet client

Did I write this code to correctly be tail call optimized? Am I forcing computations more than I need with !? Did I generally write this asynchronously correctly to allow sends and receives to occur ...
3
votes
1answer
142 views

Code Review of AsyncPages in ASP.NET 2.0

Could somebody code-review the implementation of Async in ASP.NET 2.0 web form page below and let me know If I am missing something in implementing in a correct way? AsyncPagesASPNET20.aspx <%@ ...
1
vote
0answers
471 views

Cancelling Local WebClient ASync Operation

I had previously asked this question on SO. The answer pointed me towards using the task parallel library for multiple parallel downloads. I'm not actually utilizing this exact code, but it got me ...
1
vote
1answer
743 views

Node.js Nested Callbacks, multiple requests

I'm making requests to Parse.com to 3 different objects that are needed to render a View. I'd like to know what's the general/best approach in cases like these in which there are multiple requests ...
1
vote
0answers
242 views

Node.js asynchronous code design

I am writing a lightweight JSON api, and I come from a PHP background, so I have some questions/reviews about async node.js code. This is my code so far: main.js var http = require('http'); var api ...
1
vote
0answers
246 views

Amazon s3 pass through controller [closed]

Some background, I am building a website that uses amazon s3 to host its image (and other) files. I required that images displayed on the website look like they come from my site and not from amazon ...
1
vote
2answers
138 views

A server response written in node/express/mongodb: does this look right?

This is my very very very first attempt to write anything meaningful in node. The client side is a simple form that has login, workspace, and simply saves them onto the database. It would have been a ...
3
votes
1answer
1k 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, My question is how would it be done better using Tasks or new features in .Net 4.5? public sealed class Logger : IDisposable { ...
4
votes
2answers
2k 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? public static class Logger { private static readonly object Locker = new ...
3
votes
1answer
776 views

Efficient Album Cover loading for ListView

I have a list view which display in each view a Album's name, the associated Artist and the album art. Here is the code of my ListFragment which display this list: public class AlbumsFragment ...