Click here to Skip to main content
15,925,206 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Convert MFC Toolbars to Taskbars?? Pin
Michael P Butler5-Nov-01 22:00
Michael P Butler5-Nov-01 22:00 
GeneralProblem with CHoverButton::LoadBitmap in Netscape Plugin (DLL) Pin
5-Nov-01 17:33
suss5-Nov-01 17:33 
GeneralHelp with CMutex and DB access Pin
Bill Wilson5-Nov-01 12:58
Bill Wilson5-Nov-01 12:58 
GeneralRe: Help with CMutex and DB access Pin
Joaquín M López Muñoz5-Nov-01 22:21
Joaquín M López Muñoz5-Nov-01 22:21 
GeneralRe: Help with CMutex and DB access Pin
Bill Wilson6-Nov-01 5:25
Bill Wilson6-Nov-01 5:25 
GeneralRe: Help with CMutex and DB access Pin
Joaquín M López Muñoz6-Nov-01 6:59
Joaquín M López Muñoz6-Nov-01 6:59 
GeneralRe: Help with CMutex and DB access Pin
Bill Wilson6-Nov-01 7:53
Bill Wilson6-Nov-01 7:53 
GeneralRe: Help with CMutex and DB access Pin
Joaquín M López Muñoz6-Nov-01 9:03
Joaquín M López Muñoz6-Nov-01 9:03 
No no no no no. You got it wrong. Do not have a CMutexAccessor pointer as a member of CRequests. Do not. This try catch labyrinth is something you would regret having to maintain in the long term.
Instead, have a local CMutexAccessor variable at the beginning of each protected zone, like this:
virtual void AddNew()
{
	CMutexAccesor(DBMUTEX) mut;
	CRecordset::AddNew();
}
virtual void Edit(){
	CMutexAccesor(DBMUTEX) mut;
	CRecordset::Edit();
}
and so forth. That simple. This schema ensures exclusive access among sections of code adorned this way, no matter the object, the method, the thread or the process that piece of code belongs in. What identifies the section (and I guess this is where your misunderstanding stems from) is not the particular CMutexAccesor object used to perform the locking, but only the name of the mutex (DBMUTEX in your example). Do not worry also about mutex-protected methods calling other mutex-protected methods: it'll all work like a breeze (your approach is a maintenance nightmare with respect to this).

Hope I made myself clear. Do't hesitate to ask for more help, if needed.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
GeneralRe: Help with CMutex and DB access Pin
Bill Wilson6-Nov-01 10:21
Bill Wilson6-Nov-01 10:21 
GeneralSetting a CEditView to read-only Pin
Simon Walton5-Nov-01 12:48
Simon Walton5-Nov-01 12:48 
GeneralRe: Setting a CEditView to read-only Pin
PJ Arends5-Nov-01 14:16
professionalPJ Arends5-Nov-01 14:16 
GeneralDLL/App Memory Allocation Pin
Steve The Plant5-Nov-01 11:09
Steve The Plant5-Nov-01 11:09 
GeneralRe: DLL/App Memory Allocation Pin
Joaquín M López Muñoz5-Nov-01 11:19
Joaquín M López Muñoz5-Nov-01 11:19 
GeneralRe: DLL/App Memory Allocation Pin
Steve The Plant5-Nov-01 11:41
Steve The Plant5-Nov-01 11:41 
GeneralRe: DLL/App Memory Allocation Pin
Joaquín M López Muñoz5-Nov-01 12:08
Joaquín M López Muñoz5-Nov-01 12:08 
GeneralRe: DLL/App Memory Allocation Pin
Steen Krogsgaard6-Nov-01 4:16
Steen Krogsgaard6-Nov-01 4:16 
GeneralRe: DLL/App Memory Allocation Pin
Joaquín M López Muñoz6-Nov-01 6:43
Joaquín M López Muñoz6-Nov-01 6:43 
GeneralRe: DLL/App Memory Allocation Pin
Steen Krogsgaard6-Nov-01 22:01
Steen Krogsgaard6-Nov-01 22:01 
GeneralPut value in the registry Pin
Peter Liddle5-Nov-01 10:32
Peter Liddle5-Nov-01 10:32 
GeneralRe: Put value in the registry Pin
Christian Graus5-Nov-01 10:36
protectorChristian Graus5-Nov-01 10:36 
GeneralRe: Put value in the registry Pin
Carlos Antollini5-Nov-01 10:58
Carlos Antollini5-Nov-01 10:58 
GeneralRe: Put value in the registry Pin
5-Nov-01 15:14
suss5-Nov-01 15:14 
GeneralDynamic Multidimensional Array or Alternatives Pin
Steve L.5-Nov-01 9:43
Steve L.5-Nov-01 9:43 
GeneralRe: Dynamic Multidimensional Array or Alternatives Pin
Ravi Bhavnani5-Nov-01 10:05
professionalRavi Bhavnani5-Nov-01 10:05 
GeneralRe: Dynamic Multidimensional Array or Alternatives Pin
Chris Losinger5-Nov-01 10:09
professionalChris Losinger5-Nov-01 10:09 

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.