Pratikgcet
Pratikgcet

Reputation: 31

Is ContinueWith in c# truly asynchronous?

Using ContinueWith on the task I executed is suppose to run asynchronously, but is it really asynchronous? I mean if I run a task "t" and use that task to call say t.ContinueWith(t=>t.Result), will this be run asynchronously? I know it won't block all the threads till result is complete but will it completely return the handle back to the caller or will it do context switching between threads.

Upvotes: 0

Views: 59

Answers (1)

svick
svick

Reputation: 244797

Using ContinueWith on the task I executed is suppose to run asynchronously, but is it really asynchronous?

Yes.

I mean if I run a task t and use that task to call say t.ContinueWith(t=>t.Result), will this be run asynchronously?

Yes.

I know it won't block all the threads till result is complete but will it completely return the handle back to the caller or will it do context switching between threads.

I don't know what handle are you talking about. What ContinueWith() does is to schedule the continuation to execute when the Task completes and then immediately returns.

Upvotes: 2

Related Questions