Do you want each of 5 threads to process the same data item 5 times, or just
distribute processing? If the latter, you only need 1 read pointer.
"Mark" <mark@intern.net> wrote in message
news:OTe3LCcEIHA.2268@TK2MSFTNGP02.phx.gbl...
one thread fills a circular buffer and
some 5 other threads read the data.
I'll propose something sketchy. I don't guarantee correctness.
The elements of the proposal are:
(1) The master thread fills more buffer, signals a WORKERSGO
event, then waits for a MASTERGO event (WaitForSingleObject)
(2) When a worker thread can't read yet, it stops and waits for
the WORKERSGO event (WaitForSingleObject)
(3) A critical section guards the 5 worker read pointers and 1
master write pointer
(4) When a worker thread can read, it reads a character, it
updates its read pointer. It may at this time also notice that it was
the most behind of all the worker threads, in which case it will
signal the MASTERGO event
Now, you fill in the details.