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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mutex problem

Status
Not open for further replies.

d00ape

Programmer
Apr 2, 2003
171
SE
I’d like to run something like this:

CMutex m;

for( int I = 0; I < 100; I++)
{
m.Load( INFINITE );
//”run a thread” that run m.Unload()
}

my problem is that the second time the main loop runs m.Load(INFINITE )

It doesn’t wait to my thread has runed m.Unload();

What have I missed?
 
CMutex is for one thread (owner) at a time. I only see Lock and Unlock class members. Maybe you should look into the CSemaphore. These can have several owners at a time. Hopefully, a more experienced programmer will give more insite.

Hyper
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top