c# - Chained async methods - tie a thread POV? -
Assume I have this code:
public zero AAA () {BBB ( ); } Public ASCNC Work BBB () {Waiting for the job. Daley (10000); }
IMHO, in normal mode, the method should be AAA
as well as async
so that the main thread continues without doing its job without waiting. .
But I have 2 questions about this situation:
-
Is it correct to say that the above code binds thread for 10 seconds? (I doubt that the answer is yes because AAA is not ASC, so there is no registration of continuity)
-
If so, how can I prove it by code? Am I
Is it right to say that the above code is a thread Does Tie 10 seconds?
not
AAA
call BBB
, which sets a function and returns immediately because < Code> AAA no wait
on BBB
, it comes back immediately, so the "own" thread is not tied.
Tasks. "Implementation" of Dele / itself uses the timer instead of blocking the thread, so there is no thread. The pool thread is bound to the duration of the work.
Comments
Post a Comment