Hi,

I'm updating a list (TreeView with TreeStore) from a thread when 
processing some items, something like:

while (Messages.Count > 0) {
        msg = (Message) Messages.Dequeue();
        send(msg);

         Gtk.Application.Invoke(delegate {
                treeStore.AppendAvalues(msg.To, msg.Text);
        });

        Thread.Sleep(0);
}

There's another thread adding messages to the message queue.

The problem is that sometimes the Gtk.Application.Invoke() is executed 
after I've dequeued the next message so the wrong item is added to the 
list. I could stick a greater value in Thread.Sleep() but this would be 
a kludge. Is there any thread-safe way to do this?

(Mono 1.1.13.8 for Windows)

Thanks in advance,

Leon...
_______________________________________________
Gtk-sharp-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Reply via email to