© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
23 replies
steven preadly

✅ Thread and Threading

i have asked this question on the #help-0 an here is the link https://discord.com/channels/143867839282020352/169726586931773440/1269020486952816671 according to conversation with @TeBeCo i
have changed the code to be like below by question is now
T1.join() will block the main thread till it resolves , and then the T2 will block the main thread and the T1 Thread till it resolves is that correct
        static void Main(string[] args)
        {
            Console.WriteLine("Main Thread Start");

            Thread T1 = new Thread(ThreadOneMethod);

            T1.Start();

            T1.Join();

            Thread T2 = new Thread(ThreadTwoMethod);

            T2.Start();

            T2.Join();

            Console.WriteLine("Thread Two Ends");

            Console.WriteLine("Thread One Ends");

            Console.WriteLine("Main Thread Ends");

        }

        public static void ThreadOneMethod()
        {
            Console.WriteLine("Thread One Starts");
        }


        public static void ThreadTwoMethod()
        {
            Console.WriteLine("Thread Two Starts");

        }

        public static void ThreadThreeMethod()
        {
            Console.WriteLine("Thread Three Starts");
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Main Thread Start");

            Thread T1 = new Thread(ThreadOneMethod);

            T1.Start();

            T1.Join();

            Thread T2 = new Thread(ThreadTwoMethod);

            T2.Start();

            T2.Join();

            Console.WriteLine("Thread Two Ends");

            Console.WriteLine("Thread One Ends");

            Console.WriteLine("Main Thread Ends");

        }

        public static void ThreadOneMethod()
        {
            Console.WriteLine("Thread One Starts");
        }


        public static void ThreadTwoMethod()
        {
            Console.WriteLine("Thread Two Starts");

        }

        public static void ThreadThreeMethod()
        {
            Console.WriteLine("Thread Three Starts");
        }
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

Threading Return to old thread
C#CC# / help
4y ago
Threading and Microsoft.Data.Sqlite
C#CC# / help
15mo ago
✅ THREADING & CHARTS
C#CC# / help
12mo ago
VS threading
C#CC# / help
2y ago