Click here to Skip to main content
15,914,163 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: One genneral question on dual buffers design with multi-threading Pin
Rajesh R Subramanian15-Oct-10 1:05
professionalRajesh R Subramanian15-Oct-10 1:05 
GeneralRe: One genneral question on dual buffers design with multi-threading Pin
SAMZC15-Oct-10 20:53
SAMZC15-Oct-10 20:53 
AnswerRe: One genneral question on dual buffers design with multi-threading Pin
federico.strati15-Oct-10 1:40
federico.strati15-Oct-10 1:40 
GeneralRe: One genneral question on dual buffers design with multi-threading Pin
SAMZC15-Oct-10 20:51
SAMZC15-Oct-10 20:51 
GeneralRe: One genneral question on dual buffers design with multi-threading Pin
SAMZCN15-Oct-10 23:31
SAMZCN15-Oct-10 23:31 
GeneralRe: One genneral question on dual buffers design with multi-threading Pin
federico.strati17-Oct-10 20:45
federico.strati17-Oct-10 20:45 
GeneralRe: One genneral question on dual buffers design with multi-threading Pin
SAMZC16-Oct-10 7:57
SAMZC16-Oct-10 7:57 
GeneralRe: One genneral question on dual buffers design with multi-threading Pin
federico.strati17-Oct-10 20:50
federico.strati17-Oct-10 20:50 
Note:

1. it is necessary to declare the variables volatile on some systems
to prevent using cached values, you'll be fine by declaring all the
integer indexes unRead/unWrite etc... as volatile

2. the classes are thread safe for the single situation where you have a single
producer (writer) and a single consumer (reader) in different
threads. It is NOT safe for multiple consumers / multiple producers.

3. The modifs you've done are good even if don't understand why
you changed the way you increment the pointers Smile | :)
it is not important to increment pointers in an atomic manner
as there will be only two threads: one writer and one reader.
If you want atomicity then you shall use InterlockedIncrement
/ Decrement functions. But it is a wasted effort here.

Hope that helps

Cheers
Federico
GeneralRe: One genneral question on dual buffers design with multi-threading Pin
SAMZCN18-Oct-10 2:16
SAMZCN18-Oct-10 2:16 
GeneralRe: One genneral question: there were errors in my code !!! Pin
federico.strati19-Oct-10 22:25
federico.strati19-Oct-10 22:25 
QuestionHello calling function between two different processes Pin
nah133714-Oct-10 22:42
nah133714-Oct-10 22:42 
AnswerRe: Hello calling function between two different processes Pin
CPallini14-Oct-10 22:47
mveCPallini14-Oct-10 22:47 
AnswerRe: Hello calling function between two different processes Pin
Rajesh R Subramanian15-Oct-10 0:52
professionalRajesh R Subramanian15-Oct-10 0:52 
QuestionEncrypt / Decrypt a file Pin
mesajflaviu14-Oct-10 21:51
mesajflaviu14-Oct-10 21:51 
AnswerRe: Encrypt / Decrypt a file Pin
CPallini14-Oct-10 22:32
mveCPallini14-Oct-10 22:32 
Questionstring question Pin
sadas232341s14-Oct-10 8:20
sadas232341s14-Oct-10 8:20 
AnswerRe: string question Pin
Luc Pattyn14-Oct-10 8:36
sitebuilderLuc Pattyn14-Oct-10 8:36 
QuestionRe: string question Pin
David Crow14-Oct-10 9:15
David Crow14-Oct-10 9:15 
AnswerRe: string question Pin
CPallini14-Oct-10 9:27
mveCPallini14-Oct-10 9:27 
GeneralRe: string question Pin
Luc Pattyn14-Oct-10 9:34
sitebuilderLuc Pattyn14-Oct-10 9:34 
GeneralRe: string question Pin
CPallini14-Oct-10 9:39
mveCPallini14-Oct-10 9:39 
Questionwhat does these lines mean?? Pin
AmbiguousName14-Oct-10 3:42
AmbiguousName14-Oct-10 3:42 
AnswerRe: what does these lines mean?? Pin
Cedric Moonen14-Oct-10 3:56
Cedric Moonen14-Oct-10 3:56 
GeneralRe: what does these lines mean?? Pin
AmbiguousName14-Oct-10 4:08
AmbiguousName14-Oct-10 4:08 
GeneralRe: what does these lines mean?? Pin
Cedric Moonen14-Oct-10 4:15
Cedric Moonen14-Oct-10 4:15 

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.