Streaming Security Implementation

In my application, I have 2 threads plus a main thread.

One stream is receiving data (4096 bytes into the buffer) from the I / O module when an interrupt occurs. And another thread should consume this data (process and format and write data to a file).

What would be the best way to achieve this?

I can’t lose data from the manufacturer’s stream, which happens at a high speed.

Any examples that I can study on this will be greatly appreciated.

I am trying to implement threads with thread safety and with difficulty.

I'm sorry that I forgot to include the platform and other information. I am using Windows XP (32 bit) and Microsoft Visual Studio 5.0 compiler.

+4
source share
1 answer

I am going to make an assumption that on a POSIX platform.

Use mutex

Then the consumer can chop the grub until the producer is blind.

EDIT FOR Metaphor

+1
source

Source: https://habr.com/ru/post/1438552/


All Articles