Click here to Skip to main content
15,913,941 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionFriend Functions defy OOP,why? Pin
abhinarulkar30-Oct-02 19:27
abhinarulkar30-Oct-02 19:27 
AnswerRe: Friend Functions defy OOP,why? Pin
Chris Losinger30-Oct-02 20:01
professionalChris Losinger30-Oct-02 20:01 
AnswerRe: Friend Functions defy OOP,why? Pin
Christian Graus30-Oct-02 20:14
protectorChristian Graus30-Oct-02 20:14 
GeneralAbout the Apllication using CDaoRecordset Pin
Forlegend30-Oct-02 19:24
Forlegend30-Oct-02 19:24 
GeneralRe: About the Apllication using CDaoRecordset Pin
dabs31-Oct-02 4:17
dabs31-Oct-02 4:17 
QuestionHow to use DirectShow Filters? Pin
sonshiro30-Oct-02 19:09
sonshiro30-Oct-02 19:09 
AnswerRe: How to use DirectShow Filters? Pin
Stephane Rodriguez.30-Oct-02 19:30
Stephane Rodriguez.30-Oct-02 19:30 
GeneralMutex, a simple question. Pin
devvvy30-Oct-02 18:15
devvvy30-Oct-02 18:15 
i am reading a code from a text book:

long WINAPI WaitToEat(long lParam)
{
CPhilosopher* pPhilo = (CPhilosopher*)lParam;
DWORD dwEatTime = 1000 + GetCurrentThreadId();

_tprintf(_T("Philosopher %d is alive!\n"), pPhilo->m_nID);
while(g_fDone == FALSE)
{
// Wait for my two chopsticks.
WaitForMultipleObjects(2,
pPhilo->m_hSticks,
TRUE,
INFINITE);
//
// Wait satisfied - I have both chopsticks
SayEat(pPhilo);
Sleep(dwEatTime);
SayThink(pPhilo->m_nID);
// Release both chopsticks.
ReleaseMutex(pPhilo->m_hSticks[1]);
ReleaseMutex(pPhilo->m_hSticks[0]);
}
return 0;
}

My QUESTION is:
is the mutex locked between WaitForMultipleObjects and ReleaseMutex??

I dont see any method that looks similar to:

pPhilo->m_hSticks[0].LockMutex()

I presume as soon as WaitForMultipleObjects returns, "WaitForMultipleObjects" also lock the mutex for "this" thread??

Thanks

norm
GeneralRe: Mutex, a simple question. Pin
Scott H. Settlemier30-Oct-02 18:50
Scott H. Settlemier30-Oct-02 18:50 
GeneralRe: Mutex, a simple question. Pin
devvvy30-Oct-02 19:30
devvvy30-Oct-02 19:30 
Generaldetecting server socket reset Pin
Anonymous30-Oct-02 16:53
Anonymous30-Oct-02 16:53 
GeneralRe: detecting server socket reset Pin
Member 1006688325-Jun-14 2:53
Member 1006688325-Jun-14 2:53 
GeneralDisable Item in ListBox Pin
:_Rocket_:30-Oct-02 16:45
:_Rocket_:30-Oct-02 16:45 
GenerallParam vs wParam Pin
stevenson30-Oct-02 16:36
stevenson30-Oct-02 16:36 
GeneralRe: lParam vs wParam Pin
Anatari30-Oct-02 17:05
Anatari30-Oct-02 17:05 
GeneralRe: lParam vs wParam Pin
Paul M Watt30-Oct-02 18:14
mentorPaul M Watt30-Oct-02 18:14 
GeneralRe: lParam vs wParam Pin
devvvy30-Oct-02 18:24
devvvy30-Oct-02 18:24 
GeneralMulti-threading Pin
Gary Kirkham30-Oct-02 16:31
Gary Kirkham30-Oct-02 16:31 
GeneralRe: Multi-threading Pin
Joaquín M López Muñoz30-Oct-02 20:07
Joaquín M López Muñoz30-Oct-02 20:07 
GeneralRe: Multi-threading Pin
Gary Kirkham1-Nov-02 3:35
Gary Kirkham1-Nov-02 3:35 
GeneralIE Pin
candan30-Oct-02 16:11
professionalcandan30-Oct-02 16:11 
GeneralRe: IE Pin
Stephane Rodriguez.30-Oct-02 19:33
Stephane Rodriguez.30-Oct-02 19:33 
GeneralRe: IE Pin
candan30-Oct-02 20:14
professionalcandan30-Oct-02 20:14 
GeneralRe: IE Pin
Stephane Rodriguez.30-Oct-02 20:20
Stephane Rodriguez.30-Oct-02 20:20 
GeneralRe: IE Pin
candan30-Oct-02 21:43
professionalcandan30-Oct-02 21:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.