[Gtk-sharp-list] waiting for an asynchronous operation to finish

Jeroen Zwartepoorte jeroen.zwartepoorte at gmail.com
Fri Sep 30 03:07:50 EDT 2005

On 9/29/05, Ben Maurer <bmaurer at ximian.com> wrote:
> > System.Threading.Thread has Suspend() and Resume() methods, but how do
> > these interact with the GLib mainloop?
> That would stop the thread completely. You don't want that. Basically
> Suspend/Resume == bad.
> What you want to do is this:
> Drive.Mount (delegate (bool succeeded) {
>        Application.Invoke (delegate {
>                if (!succeeded)
>                        DisplayErrorDialog();
>                else
>                        DoStuff ();
>        });
> });

The problem with that is that the location where i call Drive.Mount is
inside a TreeView TestExpandRowHandler. I need to know if the
Drive.Mount call succeeded or not before i can return from that
handler (args.RetVal determines whether or not the row can be

If i read your code right, it just defines a new delegate which gets
called at a later stage? (the code above doesn't wait for Drive.Mount
to report back)


More information about the Gtk-sharp-list mailing list