Click here to Skip to main content
15,915,508 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Impact of synchronization on application performances Pin
Ahmed Charfeddine20-Aug-08 5:54
Ahmed Charfeddine20-Aug-08 5:54 
AnswerRe: Impact of synchronization on application performances Pin
Jijo.Raj19-Aug-08 6:40
Jijo.Raj19-Aug-08 6:40 
GeneralRe: Impact of synchronization on application performances Pin
Ahmed Charfeddine19-Aug-08 6:53
Ahmed Charfeddine19-Aug-08 6:53 
GeneralRe: Impact of synchronization on application performances Pin
Jijo.Raj19-Aug-08 7:19
Jijo.Raj19-Aug-08 7:19 
GeneralRe: Impact of synchronization on application performances Pin
Ahmed Charfeddine19-Aug-08 21:50
Ahmed Charfeddine19-Aug-08 21:50 
GeneralRe: Impact of synchronization on application performances Pin
Cedric Moonen19-Aug-08 7:22
Cedric Moonen19-Aug-08 7:22 
GeneralRe: Impact of synchronization on application performances Pin
Ahmed Charfeddine20-Aug-08 0:39
Ahmed Charfeddine20-Aug-08 0:39 
GeneralRe: Impact of synchronization on application performances Pin
Cedric Moonen20-Aug-08 1:08
Cedric Moonen20-Aug-08 1:08 
hINTModuleState wrote:
My problem is that the application crashes when setName and getName are run simultaneously..


That's why I suggested to use a fixed size char array instead of a string. In that specific case, your program won't crash: you always read/write in the same memory area, so the only thing that could go wrong is data corruption. You have to make sure that both flags are equals before doing anything with the string that you read from the reader thread. The problem with CString objects is that you might have reallocation, so in some cases you could try to access an invalid CString object, which is causing the crash. You don't have this problem with fixed size char arrays, because you are in control of everything.
By the way, setting the new flag value is an atomic operation.

Cédric Moonen
Software developer

Charting control [v1.4]
OpenGL game tutorial in C++ [Part 2 online]

GeneralRe: Impact of synchronization on application performances Pin
Ahmed Charfeddine20-Aug-08 1:37
Ahmed Charfeddine20-Aug-08 1:37 
GeneralRe: Impact of synchronization on application performances Pin
Cedric Moonen20-Aug-08 2:11
Cedric Moonen20-Aug-08 2:11 
GeneralRe: Impact of synchronization on application performances Pin
Cedric Moonen31-Aug-08 22:35
Cedric Moonen31-Aug-08 22:35 
QuestionHow to get the full path of a file (Win32 api) Pin
ice87111719-Aug-08 4:43
ice87111719-Aug-08 4:43 
AnswerRe: How to get the full path of a file (Win32 api) Pin
David Crow19-Aug-08 5:07
David Crow19-Aug-08 5:07 
QuestionRe: How to get the full path of a file (Win32 api) Pin
led mike19-Aug-08 5:27
led mike19-Aug-08 5:27 
AnswerRe: How to get the full path of a file (Win32 api) Pin
ice87111720-Aug-08 19:26
ice87111720-Aug-08 19:26 
AnswerRe: How to get the full path of a file (Win32 api) Pin
Member 419459319-Aug-08 7:40
Member 419459319-Aug-08 7:40 
QuestionCString Format Help Pin
locoone19-Aug-08 4:41
locoone19-Aug-08 4:41 
AnswerRe: CString Format Help Pin
David Crow19-Aug-08 5:15
David Crow19-Aug-08 5:15 
AnswerRe: CString Format Help Pin
sudhir_Kumar19-Aug-08 5:29
sudhir_Kumar19-Aug-08 5:29 
Questionboost exe problem vs8 Pin
andymonaco19-Aug-08 4:23
andymonaco19-Aug-08 4:23 
AnswerRe: boost exe problem vs8 Pin
santhoshv8419-Aug-08 20:57
santhoshv8419-Aug-08 20:57 
AnswerRe: boost exe problem vs8 Pin
andymonaco19-Aug-08 23:05
andymonaco19-Aug-08 23:05 
QuestionWhere should I post queries about Windows Drivers? Pin
Numero Uno19-Aug-08 3:09
Numero Uno19-Aug-08 3:09 
AnswerRe: Where should I post queries about Windows Drivers? [modified] Pin
Rajesh R Subramanian19-Aug-08 3:11
professionalRajesh R Subramanian19-Aug-08 3:11 
GeneralRe: Where should I post queries about Windows Drivers? Pin
Roger Stoltz19-Aug-08 3:18
Roger Stoltz19-Aug-08 3:18 

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.