How can Unix pipes be used between main process and thread?

前端 未结 5 625
慢半拍i
慢半拍i 2021-01-05 08:31

I am trying to channel data via pipes whenever a signal arrives from a thread to the main process.

Is this possible?
How can this be done?


The pr

5条回答
  •  迷失自我
    2021-01-05 08:59

    As others have said, this may be more trouble than it is worth.

    However, if you insist.

    Probably easiest just to open two pipes using popen and rw mode before spawning the thread. Choose one for main-->thread and the other for main<--thread and just go ahead.

    Or you could open a total of four file descriptors after spawning, as if they were two different processes

提交回复
热议问题