When making UI updates with GTK# (GDK2), such as changing label text, setting button visibility etc, should I as a general rule be using Gdk.Threads.AddTimeout
or Gdk.Threads.AddIdle
?
The GDK2 documentation states that AddIdle
Adds a function to be called whenever there are no higher priority events pending.
So it would seem that AddTimeout
would provide a more responsive update. However the documentation states:
Note that timeout functions may be delayed, due to the processing of other event sources. Thus they should not be relied on for precise timing.
Which leads me to believe Idle and Timeout are both about as responsive as each other (which they seem to be, when running code).
A comment in some code I am working on suggests that Timeout results in a faster update but hits the UI harder, but I cannot find any sources to back this up.
So as a general rule, which of these methods should I be using to perform GTK updates in the main thread?
Threads.AddTimeout(0, 0, () =>
{
// do something;
return false;
});
vs
Threads.AddIdle(0, () =>
{
// do something;
return false;
});