Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • 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
Joined
May 23, 2001
Messages
143
Location
US
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.
 
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

Back
Top