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 6150575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:38:03+00:00 2026-05-23T19:38:03+00:00

I found myself wanting to implement an IAwaitable class (something that implements asynchronous calls

  • 0

I found myself wanting to implement an IAwaitable class (something that implements asynchronous calls without blocking threads).

I’ve got the most recent version of AsyncCTP installed, and the compiler is saying that I need an IsCompleted() member. Okay, so the CTP preview has moved on a little bit (I get that, like it’s a preview)

Question: What interface are the AsyncCTP language extensions expecting now?

Question: In all this I’m assuming that I can signal to the “IAwaitable” via a lamda/delegate? Is this possible? Do we call EndAwait? The intellisense suggests that you call EndAwait to retrieve the result… so that doesn’t sound right. Any ideas?

All of the examples I’ve found so far are for features that the AsyncCTP library has already implemented such as:

  await new WebClient().DownloadStringTaskAsync(uri).ConfigureAwait(false);

from the 101 AsyncSamplesCS

Background:

I find myself on Jon Skeets page (again) looking at this example

using System;

class Test
{
    static async void Main()
    {
        await new Awaitable();
    }
}

class Awaitable
{
    public Awaiter GetAwaiter()
    {
        return new Awaiter();
    }
}

class Awaiter
{
    public bool BeginAwait(Action continuation)
    {
        return false;
    }

    public int EndAwait()
    {
        return 1;
    }
}
  • 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-23T19:38:04+00:00Added an answer on May 23, 2026 at 7:38 pm

    With the SP1 refresh, you need:

    • Some GetAwaiter() method (possibly but not necessarily an extension method) that returns something (Awaiter in your example) with all of:
      • A bool IsCompleted property (get)
      • A void OnCompleted(Action callback)
      • A GetResult() method which returns void, or the desired outcome of the awaited operation

    However, I suggest you look at TaskCompletionSource<T> – I looked at this, and it out-performed my naive implementation (here; obsolete). You can also use it for void tasks, by using something like a TaskCompletionSource<bool> (and exploit the fact that the Task<bool> is also an untyped Task).

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

Sidebar

Related Questions

I just found myself creating a class called InstructionBuilderFactoryMapFactory. That's 4 pattern suffixes on
A couple of times I've found myself wanting a zip in Haskell that adds
I often found myself when writing a new class that inside a class I
I've often found myself in front of that kind of code : if(Something >
Lately, I've often found myself wanting to run some command on the output of
I have found myself designing a language for fun that is a cross between
I recently found myself writing a piece of code that executed a Core Data
Increasingly I found myself using tools based upon python, particularly that use installation processes
I found myself staring at code that looks similar to this: private double? _foo;
On more than one occasion I have found myself desiring a variable visibility that

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.