S
Steven Woody
Hi,
i am writting some classes, those need to work in both linux and
windows. in my problem, there are mutiple productor and one
consumer, productors each in a different thread are trying to append a
byte to a shared buffer while the consumer in the main thread will
remove one byte every some milliseconds.
the productors has to wait if the buffer is read/write by other
productors or the consumer, on the other hand, the consumer should
immediately exit if the buffer is read/write by any productor.
i am thinking, for the problem above, the semaphore can help. is
there a portable semaphore implementation in C++ ( if not, in C )?
thanks in advance.
-
woody
i am writting some classes, those need to work in both linux and
windows. in my problem, there are mutiple productor and one
consumer, productors each in a different thread are trying to append a
byte to a shared buffer while the consumer in the main thread will
remove one byte every some milliseconds.
the productors has to wait if the buffer is read/write by other
productors or the consumer, on the other hand, the consumer should
immediately exit if the buffer is read/write by any productor.
i am thinking, for the problem above, the semaphore can help. is
there a portable semaphore implementation in C++ ( if not, in C )?
thanks in advance.
-
woody