Click here to Skip to main content
15,892,059 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralLong Wait for a Mutex Pin
sweep12320-May-04 5:27
sweep12320-May-04 5:27 
GeneralRe: Long Wait for a Mutex Pin
valikac20-May-04 6:14
valikac20-May-04 6:14 
GeneralRe: Long Wait for a Mutex Pin
sweep12320-May-04 6:21
sweep12320-May-04 6:21 
GeneralRe: Long Wait for a Mutex Pin
valikac20-May-04 6:31
valikac20-May-04 6:31 
GeneralRe: Long Wait for a Mutex Pin
sweep12320-May-04 6:36
sweep12320-May-04 6:36 
GeneralRe: Long Wait for a Mutex Pin
valikac20-May-04 6:45
valikac20-May-04 6:45 
GeneralRe: Long Wait for a Mutex Pin
Grahamfff20-May-04 10:18
Grahamfff20-May-04 10:18 
GeneralRe: Long Wait for a Mutex Pin
Paul Ranson20-May-04 10:34
Paul Ranson20-May-04 10:34 
Your EXE and DLL both need to call CreateMutex,
hMutex = ::CreateMutex ( 0, FALSE, "CSLSharedMemLock" ) ;

Now nobody owns the mutex but everybody has a handle to it.

So when you need the mutex call,
void EnterMutex ()
{
   ::WaitForSingleObject ( hMutex, INFINITE ) ;
}

Now you own it, and when you're done with it you must call ReleaseMutex
void LeaveMutex ()
{
   ::ReleaseMutex ( hMutex ) ;
}

I think your problem is probably a confusion over ownership. The two functions above are naturally wrapped up into the constructor/destructor of a class, and error returns handled by throwing exceptions, but that's another discussion really.

Paul
GeneralRe: Long Wait for a Mutex Pin
Grahamfff20-May-04 10:45
Grahamfff20-May-04 10:45 
GeneralRe: Long Wait for a Mutex Pin
Paul Ranson20-May-04 11:34
Paul Ranson20-May-04 11:34 
GeneralRe: Long Wait for a Mutex Pin
valikac20-May-04 11:24
valikac20-May-04 11:24 
GeneralBitwise Left Shift Pin
Anthony988720-May-04 5:08
Anthony988720-May-04 5:08 
GeneralRe: Bitwise Left Shift Pin
Michael Dunn20-May-04 5:13
sitebuilderMichael Dunn20-May-04 5:13 
GeneralRe: Bitwise Left Shift Pin
Antony M Kancidrowski20-May-04 5:26
Antony M Kancidrowski20-May-04 5:26 
GeneralRe: Bitwise Left Shift Pin
mirex20-May-04 21:39
mirex20-May-04 21:39 
GeneralRe: Bitwise Left Shift Pin
Antony M Kancidrowski20-May-04 5:25
Antony M Kancidrowski20-May-04 5:25 
GeneralRe: Bitwise Left Shift Pin
deniz79s20-May-04 9:01
deniz79s20-May-04 9:01 
GeneralIt is illegal to call out while inside message filter Pin
Member 53435720-May-04 4:55
Member 53435720-May-04 4:55 
GeneralRe: It is illegal to call out while inside message filter Pin
Andrew Quinn AUS20-May-04 5:14
Andrew Quinn AUS20-May-04 5:14 
GeneralRe: It is illegal to call out while inside message filter Pin
Member 53435720-May-04 6:27
Member 53435720-May-04 6:27 
QuestionHow do I form the HTTP headers to DL a .CAB file? Pin
Terry O'Nolley20-May-04 4:39
Terry O'Nolley20-May-04 4:39 
AnswerRe: How do I form the HTTP headers to DL a .CAB file? Pin
Alexander M.,20-May-04 5:26
Alexander M.,20-May-04 5:26 
GeneralRe: How do I form the HTTP headers to DL a .CAB file? Pin
Terry O'Nolley20-May-04 6:29
Terry O'Nolley20-May-04 6:29 
Generalabout MSChart Pin
yingkou20-May-04 3:16
yingkou20-May-04 3:16 
GeneralRe: about MSChart Pin
*Dreamz20-May-04 4:13
*Dreamz20-May-04 4:13 

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.