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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:34:43+00:00 2026-05-26T13:34:43+00:00

i want to start 6 Threads asynchronously, paused them and resume synchronously… it should

  • 0

i want to start 6 Threads asynchronously, paused them and resume synchronously…

it should work like this one:

  1. Thread 1 starting (thr1.start())
  2. Thread 1 some progress (getting mac-adresses from txt-file, initializing com-objects)
  3. Thread 1 paused (paused until all threads did the same as thread 1)
  4. Thread 2 starting
  5. Thread 2 some progress
  6. Thread 2 paused
  7. Thread 3 starting
  8. Thread 3 some progress
  9. Thread 3 paused
  10. …
  11. after all 6 thread paused, they should resume all..

i tried with 6 simple boolean flags and wait until they are all true but thats quite a bit dirty…

any ideas?

EDIT (better visualization):

Thr1 | Initiliazing |waiting      |waiting      | Resuming
Thr2 | waiting      |Initiliazing |waiting      | Resuming
Thr3 | waiting      |waiting      |Initiliazing | Resuming
...           

thanks and greetz,
flux

  • 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-26T13:34:44+00:00Added an answer on May 26, 2026 at 1:34 pm

    You want some sort of synchronization – a ManualResetEvent for each thread sounds likely, depending on your thread functions.


    EDIT: Thanks for your updates – here’s a basic example:

    // initComplete is set by each worker thread to tell StartThreads to continue
    //     with the next thread
    //
    // allComplete is set by StartThreads to tell the workers that they have all
    //     initialized and that they may all resume
    
    
    void StartThreads()
    {
        var initComplete = new AutoResetEvent( false );
        var allComplete = new ManualResetEvent( false );
    
        var t1 = new Thread( () => ThreadProc( initComplete, allComplete ) );
        t1.Start();
        initComplete.WaitOne();
    
        var t2 = new Thread( () => ThreadProc( initComplete, allComplete ) );
        t2.Start();
        initComplete.WaitOne();
    
        // ...
    
        var t6 = new Thread( () => ThreadProc( initComplete, allComplete ) );
        t6.Start();
        initComplete.WaitOne();
    
        // allow all threads to continue
        allComplete.Set();
    }
    
    
    void ThreadProc( AutoResetEvent initComplete, WaitHandle allComplete )
    {
        // do init
    
        initComplete.Set(); // signal init is complete on this thread
    
        allComplete.WaitOne(); // wait for signal that all threads are ready
    
        // resume all
    }
    

    Note that the StartThreads method will block while the threads initialize – this may or may not be a problem.

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

Sidebar

Related Questions

I have a situation like this: start(); <Some code> end(); I want start() function
Often in my code I start threads which basically look like this: void WatchForSomething()
I want to start a new thread using a C function, not an objective-C
I have an activity. In this activity I want to start another activity using
I'd like to start using the Task Parallel Library , as this is the
I want to start a daemon mail service thread on tomcat server startup. So,
Right now we just use something like this stopWatch.Start(); try { method(); } finally
I used this tutorial http://delphi.about.com/od/kbthread/a/thread-gui.htm to create a class that asynchronously downloads a file
There are a few ways to execute asynchronous threads in .NET: System.Threading.Thread.Start() System.Delegate.BeginInvoke() My
I want to start service once i get BOOT_COMPLETE intent. In HTC explorer there

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.