electronicarts / ea-async

EA Async implements async-await methods in the JVM.
https://go.ea.com/ea-async
Other
1.38k stars 129 forks source link

No async/await is implemented without thread scheduling #16

Closed dunmengjun closed 6 years ago

dunmengjun commented 6 years ago

I have a doubt, I looked at your code, you use Futrue.join () method inside the Aysnc.await method to achieve the wait result returned, so there is no thread scheduling, how can we call it async/ Await?

JoeHegarty commented 6 years ago

That join is only present when the code has not been instrumented. This is so the code still "works" if you are running in a scenario where you can't instrument, but a warning will also be printed.

When the code gets instrumented by one of the methods described in the README all calls to Async.await are removed.

You can prove this by only including the async library during compilation but not at runtime and using the maven plugin. At runtime there will be no references to Async.await left.

EA Async does not deal with threading at all, but instead leaves that to the application. Continuations are scheduled on the thread that completed the last step.

Does that make sense?

dunmengjun commented 6 years ago

ok,I understand what you mean, I will read your code carefully, see what you did when modifying the bytecode, haha