asynchronous

How to synchronize asynchronous methods?

var arguments = new double[] { 1d, 2d, 3d }; var result = arguments.Select(arg => Math.Sqrt(arg)); Now imagine a asynchronous method instead of Math.Sqrt (i'm not sure the method below is a true async method, but it behaves approximately like one) public void BeginSqrt(Action<double> callback, double argument) { Thread.Sleep(100);...

How to get the maximum outbound requests when parellellizing asynchronous calls?

Analysing the code below in action through Fiddler, I realized that using Parallel Extensions I can get at maximum 2 outbound requests: new string[] { "http://stackoverflow.com", "http://superuser.com", "http://serverfault.com", "http://stackexchange.com" } .AsParallel() .Select(a => Http...

XMLHttpRequest used to find quicker server

I have a situation where my website needs to quickly retrieve data from my server via AJAX. My website runs on port 80, serving normal web pages. I normally run my AJAX server on port 8001 (I use JSONP and this works fine). This works for most users. However, some users are blocked from high ports by their local firewalls. In order to ...

MVC futures async with a custom delegate

I'm trying to use async from the asp.net mvc futures, using my own async delegate. Haven't figured out how to make it work. Here's the code: public delegate String GetString(); public String getHello() { return "Hello"; } public IAsyncResult BeginHello(AsyncCallback cb, Object state) { GetString dlgt = getHello;...

Tornado and Python 3.x

I really like Tornado and I would like to use it with Python 3, though it is written for Python versions 2.5 and 2.6. Unfortunately it seems like the project's source doesn't come with a test suite. If I understand correctly the WSGI part of it wouldn't be that easy to port as it's spec is not ready for Python 3 yet (?), but I am rather...

C# /ASP.NET Asynchronous Thread Execution

I have some doubts on executing the following : public class Test { delegate int TestDelegate(string parameter); static void Main() { TestDelegate d = new TestDelegate(PrintOut); d.BeginInvoke("Hello", new AsyncCallback(Callback), d); // Give the callback time to execute - otherwise the app ...

C# -Four Patterns in Asynchronous execution

I heard that there are four patterns in asynchronous execution . "There are four patterns in async delegate execution: Polling, Waiting for Completion, Completion Notification, and "Fire and Forget". When I have the following code : class AsynchronousDemo { public static int numberofFeets = 0; public delegate long Statistical...

What is the trade of between OneWay and Async calls for broadcasting events to clients? (WCF)

I am writing a WCF (netTcpBinding planned at present) client/server application that has to support a “handful” of clients including sending events to the clients. I do not wish the server to block while the clients process the events. Logically I cannot see match difference between marking the callback methods as “OneWay” or cal...

ASP.NET UpdatePanel Cancel Previous AsyncPostBack

I have more than one UpdatePanel inside a webform. Inside a UpdatePanel I have a button which triggers AsyncPostBack. According to my requirement I need to cancel any previous pending AsyncPostBack triggered by this button before triggering a new AsyncPostBack, but without aborting any other postback. For instance when I cancel postback...

Is there any circumstance in which calling EnterWriteLock on a ReaderWriterLockSlim should enter a Read lock instead?

I have a seemingly very simple case where I'm using System.Threading.ReaderWriterLockSlim in the 3.5 version of the .NET Framework. I first declare one, as shown here: I put a break point right before the lock is acquired and took a screen shot so you can see (in the watch window) that there are currently no locks held: Then, ...

Ajax async option throwing me for a loop

I'm using ajax to do some validation on some dates passed (basically making sure that the first date/time occurs before the 2nd date/time, and neither are blank). If I have async set to true, it works, but I get a false positive because it's working at the same time as the rest of my form validation. If I set it to false, then I get an...

Asynchronous waiting while C# function is executing

I have a blocking function that executes an asynchronous MySQL query and returns the result when it is obtained. The reason is is asynchronous is this program is not allowed to lock up during a query. The function is called when the user presses a button, so the function may get called several times before the first query completes. I t...

Scroll to top of page after async post back

So I need to scroll to the top of the page after an async post back in an asp.net update panel. The code I used was this: Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestEventHandler); function EndRequestEventHandler(sender, args) { scrollTo(0,0); } However, I only want this to be run when I click on a cert...

The easiest way to perform asynchronous operations in Java web applications

I have Java servlet-based web applications. I would like to implement some operations in asynchronous manner, like for example writing to a log. I would like to avoid JMS overhead and do something simple. Managing threads myself doesn’t seem such a good idea in a server environment, you would probably need to tap into server thread p...

/proc/sys/fs/aio-nr is never higher than 1024 (AIO on linux)

I'm trying to use async io on linux. As far as i know there're 3 options: kernel calls (io_submit and friends) libRT - uses threads in user space libRTKAIO - wrapper of kernel calls which does not use threads I'm using the last option, and i see, that in my unit test that runs a lot of async io requests in multiple threads, /proc/sy...

Has anyone done a performance analysis of boost::asio ?

I require socket-like local IPC. I used named pipes and overlapped IO on windows and I want to rewrite the application to boost::ASIO so that it can use UNIX domain sockets as well. I've recently reviewed parts of the libevent library and I know it only supports socket() and select() for windows in the 1.4 version. As overlapped IO is v...

Tornado Web & Persistent Connections

How can I write Http server in TornadoWeb that will support persistent Connections. I mean will be able to receive many requests and answer to them without closing connection. How does it actually work in async? I just want to know how to write handler to handle persistent connection. How actually would it work? I have handler like t...

How to I use my own interface with OperationContext.Current.GetCallbackChannel?

see also Why do I get InvalidCastException from OperationContext.Current.GetCallbackChannel<>() I wish to pass my own interface to OperationContext.Current.GetCallbackChannel, as I wish to make Asynchronous calls to the client(s) and hence need to add the “BeginMethod()” etc to the interface. I can anexception saying it can’t cast to ...

Python asynchronous callbacks and generators

Hello, I'm trying to convert a synchronous library to use an internal asynchronous IO framework. I have several methods that look like this: def foo: .... sync_call_1() # synchronous blocking call .... sync_call_2() # synchronous blocking call .... return bar For each of the synchronous functions (sync_call_*), I have...

Async Controller asp.net mvc 2.0

Currently MS has been release asp.net MVC 2.0 beta with the AsyncController in it but there are very few document about this except one document at: http://msdn.microsoft.com/en-us/library/ee728598%28VS.100%29.aspx The example from microsoft show that there is an event was used in the process of making an AsyncController. However, the...