Re: gio synchronized unmount ?



Hi,

First, I would like to apologize in advance if I not writing to the good
mailing list.
No worries, you hit the right target here ;-)

I would like to write code that unmount a partition in a synchronized
way. ie. something like :

Gmount* mount = get_the_mount_to_unmount(...)
perform_unmount(mount)
/* Here it's sure that the unmount is done (if no error) */

g_mount_unmount_with_operation function performs an async unmount and
calls an instance of GAsyncReadyCallback when done. I don't know how to
wait for the callback to execute.
We don't have a sync version of the unmount operation because normally
unmount operations will need time (and maybe even user interaction, if you
use g_mount_unmount_with_operation, which you should be doing).

It doesn't seems that the callback is
executed in another thread so I guess it is related to glib main loop
but I'm not sure.
The (un)mount operation itself is done in the background (most likely
in a thread) but since GIO uses GSimpleAsyncResult internally the callback will be called in the thread default main context (by using a g_idle_add).

Any help appreciated.
I guess the easiest thing to do is to just move your "logic", i.e. the
operations what you wanna do, into the callback.

Not sure that was very helpful,
Ck


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