- CreateEvent to synchronize read/write to shared memory Problem!!
- Posted by pfnus on May 28th, 2004
if i have two processes; and i need to sync the read and write for
this two processes. I just have 2 processes, one do just read, one
just write.
Process A read, and Process B wtite to shared memory.
To better illustrate my point: -
Initial state: writeStatus ON, readStatus OFF
Process A to read, B to write.
Now let's say the sequence of happening is as follow:-
1)A check writeStatus, it is ON, so it waits.
2)B check ReadStatus, it is OFF, so it can write.
3)B now got data, so it writes.
4)B finished, set writeStatus to OFF, (NOTE:-at this point readStatus
is still OFF!!!)
5)A check writeStatus, it is OFF, so it can read.
6)A goes to read, but before A has a chance to set readStatus to ON, B
got some data and seeing that readStatus is OFF, it thought it can
write!!!
I need help on how to solve this...
- Posted by Mihajlo Cvetanovic on May 28th, 2004
pfnus wrote:
Pipes do just what you need, in fact pipes internally use shared
memory as FIFO buffer... Find help for CreateNamedPipe. It's easy to
use them, and you won't be needing events then.
- Posted by lev on May 28th, 2004
Mailslot is another option
"Mihajlo Cvetanovic" <mac@RnEeMtOsVeEt.co.yu> wrote in message
news:40B75A3D.3020804@RnEeMtOsVeEt.co.yu...
- Posted by Sten Westerback on May 31st, 2004
Both are good options but if OP want's to keep his current code
then using a a critical section (or mutex) to syncronize data buffer
access would seem like a good replacement for the events.
- Sten
"lev" <ltsentsiper@brandsoft.com> wrote in message
news:CnJtc.4983$pt3.1342@attbi_s03...
- Spyware tries to write to read-only memory, can't start XP (Help and Support) by xpnovice
- why:memory read/write fine, but debugger halts (Microprocessors) by John Black
- any example about read/write memory direct in driver? (Drivers) by xiang shifu
- read/write lag on shared folders when using D-Link equipment (Networking) by Lila
- Re: Read/Write memory in CODE segment (Development Resources) by nadeem haider

