c++ - 64 bit Linux g++ passing STRUCT btw two threads via pipe -


i have c++ app running on 64 bit linux. planning pass simple struct data (without virtual function in it) 1 thread thread ( in same process) via pipe without special consideration of alignment. basically, sending side sends amount of sizeof(struct) bytes. , recving side cast bytes struct. there no concurrent access/atomicity concern. , there won't plan pass data different process or remote machine in future.

i positive code work expected.

however, opinions experts of on approach see if there potential issues. ( testing might not disclose them in case).

i rather use std::deque<mystruct>, , use simple synchronisation mechanism std::condition_variable notify consumer thread available data, plus std:::mutex make writing/reading to/from queue thread safe.

i think should far more efficient pipe handle , of write()/read() operations coming along such technique.


Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

android - How to create dynamically Fragment pager adapter -

1111. appearing after print sequence - php -