-1

So on an asynchronous framework such as Node or Netty, a worker thread can be given an IO job, which it initiates along with a callback. Then it returns and picks up a different task while that IO job, be it disk read, DB query, etc, runs.

My question is, after the IO is done, how is that event/callback picked up for further processing? I'm assuming in a synchronous operation, there is a thread right there waiting. But in an asynchronous environment, what picks up the completion of the IO, along with the response data? Does the worker thread periodically check for completion? Or does something register the completion event somehow with Node or Netty?

Sorry for lumping Netty and Node together, I'm assuming they do this similarly.

JeffLL
  • 1,875
  • 3
  • 19
  • 30
  • possible duplicate of [How does Asynchronous programming work in a single threaded programming model?](http://stackoverflow.com/questions/8982489/how-does-asynchronous-programming-work-in-a-single-threaded-programming-model) – Gntem Mar 20 '14 at 08:19

1 Answers1

0

In Netty, any IO operation is asynchronous,and the read or write method will return a Future Object which can add Listener, after future is done , the listener will call back. In listener, you can do anything you would like.

xiang min
  • 51
  • 2