[gtkmm] repainting with threads



Hello,

I have a program with a TextView that gets text from another thread that listens for data on a network socket.

Now, when this other thread adds text to the TextView, i naturally want to repaint it, so I call queue_draw(). But I want to draw immediately... So I did some searching, and found that I could call

while(Gtk::Main::events_pending()) Gtk::Main::iteration();

This does what I want, but when the network thread calls it, the program hangs afterwards, and I get a warning that says that the main loop is active in another thread (the main thread, of course...).

Has anyone been in this situation? How should I approach this problem? I need to get the main thread to call the while(...) stuff, I guess, but how? (Maybe this is ridiculously easy, but I can't figure it out).

--
Tor Arvid Lund




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]