© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•9mo ago•
6 replies
iskander

✅ Understanding Awaits

async Task SomeFunc()
{
    //some synchronous operations
    var task = SomeAsyncTask();
    // some more synchrounous operations that depends on the execution of the function above
    await task;
}

async Task SomeAsyncTask()
{
    // some synchronous operations that SomeFunc depends on
    await Task.Delay(1000); //stuff we dont care about
    // stuff we are fine with executing sometime later
}
async Task SomeFunc()
{
    //some synchronous operations
    var task = SomeAsyncTask();
    // some more synchrounous operations that depends on the execution of the function above
    await task;
}

async Task SomeAsyncTask()
{
    // some synchronous operations that SomeFunc depends on
    await Task.Delay(1000); //stuff we dont care about
    // stuff we are fine with executing sometime later
}

would the program above behave as i expect it to? or will i have a race condition in my hands?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

understanding %
C#CC# / help
2y ago
✅ understanding interfaces
C#CC# / help
3y ago
❔ Understanding Delegates
C#CC# / help
3y ago
❔ Understanding inheritance
C#CC# / help
4y ago