开发者

Reattaching to an orphan process in QT

开发者 https://www.devze.com 2022-12-12 01:31 出处:网络
We\'re preparing an application using Qt that has a main process that controls the GUI and spawns processes that do the actual data processing. Messages are exchanged between the main process and the

We're preparing an application using Qt that has a main process that controls the GUI and spawns processes that do the actual data processing. Messages are exchanged between the main process and the data-processing processes using the Qt mechanisms and the stdin/stdout pipes.

Now, in the event that the GUI crashes, the other processes keep running. What we'd like to be able to do is to, when a new GUI starts, reconnect to these processes as before. Anyone know if this is possible, and if so, how to ach开发者_StackOverflowieve it?


This is possible if you are using a named pipe for communicating with the process. stdin/out are closed if the process they belong to is terminated.


You might want to investigate shared memory for the communication between processes. I seem to recall that it was able to recover in a very similar situation at a previous job.

Another possibility, if your platform supports it, is to use dbus for the communication between processes. If that is the case, neither process would have to be there, but will act get the appropriate messages if it is running.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号