© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
47 replies
1FriendlyDoge

✅ Run code in main thread after Task.Run completed?

Hello, I have a long running void function that I execute in a separate thread by calling
Task.Run(MyFunction)
Task.Run(MyFunction)
. Now how could I run another function in the main thread when this one ends? Do I need to make an event or something? What are the common approaches to this?
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

EnumerateFiles Blocks UI thread even in Task.Run()
C#CC# / help
11mo ago
Task.Run() in .net framework
C#CC# / help
13mo ago
❔ Running an awaitable async Task, but forcing it to run on a specific thread (main thread).
C#CC# / help
3y ago
Run Method on other thread and call method on main thread after it finished
C#CC# / help
4y ago