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

  • SEARCH
  • Home
  • 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 8805905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:59:05+00:00 2026-06-14T01:59:05+00:00

The new async language features in c# 5.0 rely heavily on the Task object,

  • 0

The new async language features in c# 5.0 rely heavily on the Task object, and lots of examples show that one common way to run some of your code in a Task is to start it via Task.Run(), which represents your code as a Task and runs it on a threadpool thread.

However, I also have read that one should not start long-running code on the threadpool threads, which leads me to this question: is it possible to still use all the C# async language features (such as Task, ‘await’, ‘async’) on “regular” threads and not use the threadpool? In this case, how would one get a Task object representing code running on a “regular” thread?

And as a follow up question about the rule of not running long-running code in the threadpool – is this rule only about code that is cpu intensive? What if your code runs a long time (72 hours, for example) but spends most of its time doing things like “await Task.Delay()”.. is it then okay to use threadpool threads, or should one use “regular” threads in all cases where your concurrent code needs to run for a long time?

  • 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-06-14T01:59:05+00:00Added an answer on June 14, 2026 at 1:59 am

    I also have read that one should not start long-running code on the threadpool threads

    The thread pool will respond to long-running code correctly, so it’s not like you can’t do it – it’s just not the most efficient way to do it.

    Also note that Task.Delay implies the opposite of “long-running” – the individual Task actually completes at the point of the await and is no longer on the thread pool. Another Task is created and queued to the thread pool when Task.Delay completes. The Task returned by Task.Run (when you pass it an async delegate) is actually a “proxy Task” that represents the entire delegate.

    is it possible to still use all the C# async language features (such as Task, ‘await’, ‘async’) on “regular” threads and not use the threadpool?

    In your situation, you don’t need it, but it is possible. My AsyncEx library includes an AsyncContextThread type that exposes a TaskFactory property you can use to start Tasks on that thread.

    I’m servicing all instances “in parallel” using Task.Run()

    In your case, you don’t need Task.Run or a TaskFactory at all. You can easily do this in parallel without explicitly sending work off to the thread pool:

    string[] instanceNames = ...;
    var tasks = instanceNames.Select(ServiceInstanceAsync);
    await Task.WhenAll(tasks);
    
    private static async Task ServiceInstanceAsync(string name)
    {
      await DownloadAndProcessFileAsync();
      await Task.Delay(15000);
      await ExecuteSSHAsync();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using the new async/await model it's fairly straightforward to generate a Task that is
Two new keywords added to the C# 5.0 language are async and await ,
When the new async and await features go live, will I be able to
Is there a way in the new async dotnet 4.5 library to set a
I am new to async task . I need to use httppost in my
Is it possible start a new thread within an Async task? Something like this:
I have an application and every new created activity will start an async task
I have an async method: public async Task<UserLoginExResult> LoginExAsync(CustomTable exRequest, string language, bool throwEx
Trying to understand the new async/await pattern, I have one question which I can't
I am just using the new Async Controller features in MVC 4 as described

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.