Adding gtk graphics to existing console application - shared memory?

176 views Asked by At

I have concurent application (concurrent simulation of an airport) made with system v library (semaphores, message queue) and multiple processes.

I'm not allowed to use threads, that's why I have an processes thread and multiple 'planes' processes.

I would like to add some graphics to show traffic on an airport with GTK (with Cairo) library.

How to add graphic? When I tried to add it to airport process, gtk_main would block whole application. I thought about creating another process and add graphics to shared memory but I've read that it's not going to work.

What is the easiest/the best option?

Thank you very much!

1

There are 1 answers

0
ptomato On

It sounds like you should make a separate GUI process that the other processes can send messages to. One way to do this would be for your GUI process to export a DBus interface that the other processes can connect to. This way, when your GUI process receives a message from another process, your GTK main loop will emit a signal, and you can schedule a signal handler to deal with it and update the GUI accordingly.