Questions tagged [asynchronous]

Asynchronous programming is a strategy for deferring operations with high latency or low priority, usually in an attempt to improve performance, responsiveness, and / or composability of software. Such strategies are usually employed using some combination of event-driven programming and callbacks, and optionally making use of concurrency through coroutines and / or threads.

Asynchronous programming is a strategy for deferring operations with high latency or low priority, usually in an attempt to improve performance, responsiveness, and / or composability of software. Such strategies are usually employed using some combination of event-driven programming and callbacks, and optionally making use of concurrency through coroutines and / or threads.

Asynchronous programming is used in many situations:

  • handling user input in UIs and games,
  • processing network traffic,
  • performing disk I/O,
  • batching work,
  • and more.

Asynchronous programming models can aid in software composition in many languages (notably languages where functions are first-class types) and APIs providing callback-based completion messaging. Proper use of this programming methodology can improve throughput and improve responsiveness by reducing total latency of job batches when executed in parallel. This approach can also result in an increase in system throughput at the cost of increased operational latency resulting from deferred processing.

50995 questions
13
votes
2 answers

What is a proper implementation of the IAsyncResult interface?

I'm looking into adding some flexibility to a class that I've created which establishes a connection to a remote host and then performs an exchange of information (a handshake). The current implementation provides a Connect function which…
Mike Dinescu
  • 54,171
  • 16
  • 118
  • 151
13
votes
1 answer

Synchronous and asynchronous activities

Can anyone help me to understand synchronous and asynchronous activities in Android? What is exactly meant by synchronous and asynchronous activity in Android? StartActivity, StartSubActivity and StartAcivityForResult start an activity …
Dinesh Sharma
  • 11,533
  • 7
  • 42
  • 60
13
votes
2 answers

How do I schedule a conditional ContinueWith

I have some GUI on a bunch of LINQ queries. The queries take some time to execute, so I would like for the GUI to be responsive and show busyindicators and progress bars. Many of the queries are to check for certain conditions existing in the data.…
Tormod
  • 4,551
  • 2
  • 28
  • 50
13
votes
2 answers

await/async vs. "classic" asynchronous (callbacks)

So the new async CTP is very cool; it makes my life a lot easier not having to write named callback methods and makes the intent of the methods a lot clearer. Now that I've gotten to play with it a little, I'm wondering what differences there may be…
foxy
  • 7,599
  • 2
  • 30
  • 34
13
votes
3 answers

How to avoid request set ASYNC_SUPPORTED=true to enable async servlet 3.0 processing on Tomcat 7?

Following an issue reported on this question, a solution was found: req.setAttribute("org.apache.catalina.ASYNC_SUPPORTED", true); This seems a bit strange and is not really 'portable' code (it won't hurt, but...). It seems specific to Tomcat 7. I…
Jérôme Verstrynge
  • 57,710
  • 92
  • 283
  • 453
13
votes
2 answers

IllegalStateException: Not supported on AsyncContext.startAsync(req, res)

I have created a servlet 3.0 to explore asynchronous request processing: @WebServlet(name="MyTest", urlPatterns={"/MyTest"}, asyncSupported=true) public class MyTest extends HttpServlet { @Override public void doGet(HttpServletRequest req,…
Jérôme Verstrynge
  • 57,710
  • 92
  • 283
  • 453
13
votes
3 answers

Call asynchronous function inside for loop

var path; for (var i = 0, c = paths.length; i < c; i++) { path = paths[i]; fs.lstat(path, function (error, stat) { console.log(path); // this outputs always the last element }); } How can I access the path variable, that…
user196106
13
votes
2 answers

Calling std::async twice without storing the returned std::future

According to the C++17 standard, what is the output of this program? #include #include #include int main() { std::string x = "x"; std::async(std::launch::async, [&x]() { x = "y"; }); …
Yasuo
  • 133
  • 7
13
votes
6 answers

What is the difference between asynchronous I/O and asynchronous function?

Node.js, is an asynchronous I/O. what does this actually mean? Is there different between I create an async function by spawning another thread to do the process? e.g. void asyncfuntion(){ Thread apple = new Thread(){ public void run(){ …
TheOneTeam
  • 25,806
  • 45
  • 116
  • 158
13
votes
1 answer

Using Parallel.ForEachAsync

I'm trying to run a Parallel.ForEachAsync(), but I am getting these two errors: Error 1: Argument 2: can not convert from System.Threading.Tasks.ParallelOptions to System.Threading.CancellationToken Error 2: Delegate Func
13
votes
3 answers

Dynamic, cross-browser script loading

I know that IE doesn't have a load event for