Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

C++ threads

Status
Not open for further replies.

Striker

Computer
May 23, 2001
143
How can I pause the execution of a program and wait on another thread to complete. I am trying to run another program through ShellExecute on a list of files, however, I end up with a window for each ShellExecute I call, rather than each window completing and continuing to the next file to process in my ListBox control.
 
Replies continue below

Recommended for you

The key of working with threads are sychonizing mechanisms. A common one is a Semaphore. As you may know, a semaphore is basically a shared resource handler that flags an object as used or unused to prevent other threads from trying to use it at the same time. It isn't automatic, your program has to lock a resource and unlock it when it's done. You can use this in combination with a process flag to indicaate the status of a task being done. Look up semaphores in your references or on the net. I think you will find excatly what you are looking for there. Now I'm assuming that all the process you are refering to are in the same program. If it's two seperate programs, you'll have to adapt this concept with a shared resource accessible from both programs. Hope that helps get you started. :)


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor