jeudi 13 août 2015

How to write data into a buffer and write the buffer into a binary file with a second thread?

I am getting data from a sensor(camera) and writing the data into a binary file. The problem is it takes lot of space on the disk. So, I used the compression from boost (zlib) and the space reduced a lot! The problem is the compression process is slow and lots of data is missing.

So, I want to implement two threads, with one getting the data from the camera and writing the data into a buffer. The second thread will take the front data of the buffer and write it into the binary file. And in this case, all the data will be present.

How do I implement this buffer? It needs to expand dynamically and pop_front. Shall I use std::deque, or does something better already exist?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire