As far as I know, when runtime comes across the statement below it wraps the rest of the function as a callback to the method which is invoked asynchronously (someCall()
in this example). In this case anotherCall()
will be executed as a callback to someCall()
:
await someCall();
await anotherCall();
I wonder if it is possible to make runtime perform like this: call someCall()
in async fashion and return immediately to the calling thread, then invoke anotherCall()
similarly (without waiting someCall
to complete). Because I need these two methods to run asynchronously and suppose these calls are just fire and forget calls.
Is it possible to implement this scenario using just async
and await
(not using old begin
/end
mechanism)?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…