Check out the new USENIX Web site. next up previous
Next: The GnomeVFSAsyncHandle object Up: Unix file system extensions Previous: Synchronous I/O Example

Asynchronous API

In the asynchronous API calls, instead, the operation requested is started in a separate thread of execution and control returns to the caller immediately. The caller will have to specify a callback function that will be called when the operation is completed. If the operation is long to perform (such as a ``copy'' operation), the callback might be called more than once to report progress.

All the syncrhonous API calls have asynchronous counterparts; their name is the same as the synchronous one, but use the gnome vfs async prefix, instead of just gnome vfs.

Callbacks for asynchronous operations are triggered in the normal GLib/GTK+ event loop. This means that the application will be able to handle GUI events and GNOME VFS events simultaneously and transparently. The programmer just needs to set up the callback functions and make sure the event loop is running all the time. This makes usage of GNOME VFS in GUI applications very convenient and easy to use.



Subsections

Ettore Perazzoli 2000-04-26