I\'m trying to write a instant messaging program, the basic ui is almost finished and i\'m looking into the receiving part of messages. I have an UI class and a threaded Receive
No. Don't use threads. Instead, use glib.io_add_watch to make gtk/glib itself call your function when the socket is ready to read. That way you won't freeze your gui and won't need threads. You also won't need idle_add
.
If you do 1, you won't have this problem, since messages will arrive in order and there will be no concurrent threads to confuse the data.