Click here to Skip to main content
15,880,796 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Trapping WM_KEYDOWN and WM_KEYUP on entering text in edit control Pin
Stuart Dootson23-Apr-09 15:27
professionalStuart Dootson23-Apr-09 15:27 
GeneralRe: Trapping WM_KEYDOWN and WM_KEYUP on entering text in edit control Pin
EvScott23-Apr-09 15:45
EvScott23-Apr-09 15:45 
GeneralRe: Trapping WM_KEYDOWN and WM_KEYUP on entering text in edit control Pin
EvScott23-Apr-09 16:28
EvScott23-Apr-09 16:28 
Questionadding percentage to calculator Pin
icechef23-Apr-09 12:04
icechef23-Apr-09 12:04 
AnswerRe: adding percentage to calculator Pin
EvScott23-Apr-09 12:48
EvScott23-Apr-09 12:48 
GeneralRe: adding percentage to calculator Pin
icechef23-Apr-09 20:51
icechef23-Apr-09 20:51 
AnswerRe: adding percentage to calculator Pin
CPallini23-Apr-09 21:24
mveCPallini23-Apr-09 21:24 
QuestionThreadsafe Data Class Pin
softwaremonkey23-Apr-09 6:40
softwaremonkey23-Apr-09 6:40 
Hi,

I have an object which is purely a data structure which is shared between several threads. At present, I control access using a mutex which I grab when I need to use the data object. The problem is I have already found places where I have missed the WaitForSingleObject() to lock the data so I am considering making all data members private and using Get/Set members which will automatically grab and release the mutex.

My concern is what will be the impact on performance? At present, I only need to lock the mutex once before accessing all data members, then release the mutex.

To put some figures on things, the program runs a timer thread at a rate of 10Hz, three or four other threads need to access the data object at rates between 10Hz and 1Hz and there are 8 doubles in the data class.

I am really looking for opinions on whether there will be an appreciable performance hit from making it totally threadsafe.

Thanks

Tony Big Grin | :-D
AnswerRe: Threadsafe Data Class Pin
Stuart Dootson23-Apr-09 6:56
professionalStuart Dootson23-Apr-09 6:56 
GeneralRe: Threadsafe Data Class Pin
softwaremonkey23-Apr-09 7:07
softwaremonkey23-Apr-09 7:07 
GeneralRe: Threadsafe Data Class Pin
Stuart Dootson23-Apr-09 7:10
professionalStuart Dootson23-Apr-09 7:10 
GeneralRe: Threadsafe Data Class Pin
softwaremonkey23-Apr-09 9:03
softwaremonkey23-Apr-09 9:03 
GeneralRe: Threadsafe Data Class Pin
led mike23-Apr-09 9:04
led mike23-Apr-09 9:04 
GeneralRe: Threadsafe Data Class Pin
Stuart Dootson23-Apr-09 9:16
professionalStuart Dootson23-Apr-09 9:16 
GeneralRe: Threadsafe Data Class Pin
led mike23-Apr-09 10:09
led mike23-Apr-09 10:09 
AnswerRe: Threadsafe Data Class Pin
Luc Pattyn23-Apr-09 9:19
sitebuilderLuc Pattyn23-Apr-09 9:19 
GeneralRe: Threadsafe Data Class Pin
softwaremonkey23-Apr-09 21:47
softwaremonkey23-Apr-09 21:47 
AnswerRe: Threadsafe Data Class Pin
Roger Stoltz23-Apr-09 22:03
Roger Stoltz23-Apr-09 22:03 
GeneralRe: Threadsafe Data Class Pin
Luc Pattyn24-Apr-09 1:43
sitebuilderLuc Pattyn24-Apr-09 1:43 
Questionuse printf or cout in MFC Pin
johnjitu23-Apr-09 4:35
johnjitu23-Apr-09 4:35 
QuestionRe: use printf or cout in MFC Pin
David Crow23-Apr-09 4:45
David Crow23-Apr-09 4:45 
AnswerRe: use printf or cout in MFC Pin
johnjitu23-Apr-09 4:48
johnjitu23-Apr-09 4:48 
GeneralRe: use printf or cout in MFC Pin
johnjitu23-Apr-09 5:01
johnjitu23-Apr-09 5:01 
QuestionRe: use printf or cout in MFC Pin
David Crow23-Apr-09 5:03
David Crow23-Apr-09 5:03 
AnswerRe: use printf or cout in MFC Pin
johnjitu23-Apr-09 5:09
johnjitu23-Apr-09 5: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.