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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:26:41+00:00 2026-06-13T07:26:41+00:00

How to call 3 threads sequentially many times? For example: In iteration 1, execution

  • 0

How to call 3 threads sequentially many times? For example: In iteration 1, execution order should be “Thread0->thread1->thread2” then in iteration 2 should be same i.e “Thread0 -> thread1->thread2” and so on. The sample code is just executing 3 threads only once. It is not going to 2nd iteration.

    Thread0 = CreateThread( NULL,0,ThreadProc0, NULL, CREATE_SUSPENDED, &ThreadID);
    Thread1 = CreateThread( NULL,0,ThreadProc1, NULL, CREATE_SUSPENDED, &ThreadID);
    Thread2 = CreateThread( NULL,0,ThreadProc2, NULL, CREATE_SUSPENDED, &ThreadID);

    for(i=0;i<iterations;i++)                //Iterations in calling threads
    {
        ResumeThread(Thread0);
        WaitForSingleObject(Thread0, INFINITE);
        ResumeThread(Thread1);
        WaitForSingleObject(Thread1, INFINITE);
        ResumeThread(Thread2);
        WaitForSingleObject(Thread2, INFINITE);
    }

    // Close thread and semaphore handles
  • 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-13T07:26:41+00:00Added an answer on June 13, 2026 at 7:26 am

    I think you misunderstand the concept. ResumeThread means to re-start the thread, not re-run the thread proc from the beginning. It just resume the proc from where it is stopped previously.

    Basically there are two ways.

    1. Create new threads in each iteration.
    2. Rewrite your thread proc to live “forever” and sync with it using events.

    Refer to here: How to restart threads?

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

Sidebar

Related Questions

I have many threads using the below interface ServerMessage If many threads call the
I want my function to only run once. Meaning that if many threads call
Is it okay if two threads call open() at the same time? How would
this call my $th = threads->create(\&print, Hello thread World!\n); $th->join(); works fine. But as
It's clear from reading through threads that I can call a PHP function using
I have a program with three threads. I call them like this: if __name__
Where is the TickCount() call? I have seen several threads on the web that
I'd like to have two Threads. Let's call them : Thread A Thread B
I'd like to log the number of active threads created by a newCachedThreadPool call.
If multiple threads call System.out.println(String) without synchronization, can the output get interleaved? Or is

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.