Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7038839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:43:03+00:00 2026-05-28T01:43:03+00:00

Bearing in mind the Async CTP promotes implicit scheduling via an ambient SynchronizationContext ,

  • 0

Bearing in mind the Async CTP promotes implicit scheduling via an ambient SynchronizationContext, is there any reason why I should not make my CancellationToken and IProgress ambient too?

I’m currently passing these through methods, much like I was passing a TaskScheduler around for explicit scheduling. However, seeing as the scheduler is now supposed to be ambient, mightn’t I follow the same rule for the other pieces of the puzzle?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T01:43:04+00:00Added an answer on May 28, 2026 at 1:43 am

    CancellationToken is a more probable candidate for this than IProgress<T>. With IProgress<T>, you often have a different T at different levels (higher-level async methods combine the progress notifications of their lower-level await calls). With CancellationToken, the same token is almost always passed down to the lower-level async methods (assuming they support cancellation). CancellationToken does support some really advanced combinators, but they’re hardly ever used.

    The primary disadvantage is that you’d be departing from the Task-based Asynchronous Pattern. You’d have to keep in mind that any Microsoft or 3rd-party code would take an explicit CancellationToken – sp you’d have to explicitly pull it out of your ambient context in your lowest-level async methods. Also, programmers maintaining your code base later are likely to expect TAP.

    There’s also a challenge when you consider implementation. You’d want the implicit CancellationToken to follow the invocations of async methods, even if they change thread contexts. I mean, consider this: method A calls ConfigureAwait(false) before awaiting the result of method B. You can’t use a simple thread-local static property, because you need to follow the async execution context from one thread to another.

    I seem to recall reading about a way to do this (possibly using the CallContext class?), but as soon as you do it your performance tanks (the execution context migration code is highly optimized for the default scenario).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way, bearing in mind the way the jQuery Mobile framework operates,
Bearing in mind that I'll be performing calculations on lat / long pairs, what
Bearing in mind this is for classic asp Which is better, all HTML contained
There's a file that I would like to make sure does not grow larger
Bearing in mind the answers given to a question about a safer formatting library
I started objective-c and iOS a couple of weeks ago (worth bearing in mind),
I was wandering if there is an API to upgrade an application to newer
Is there a way that I can get the count number for an iterator?
IS there a clean and concise way to put multiple swfobjects into one page
I have 2 tables that are similar but not the same so a union

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.