mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-05 23:48:44 +02:00
docs: Expand introduction to mention using async calls over sync ones
As discussed on the mailing list (see the whole thread): https://mail.gnome.org/archives/desktop-devel-list/2015-February/msg00126.html Expand the GIO documentation introduction to talk a little about when to use async and sync functions, and how the former should almost always be preferred over the latter. Link to this from the GFile documentation, which is an entry point for a lot of async calls. https://bugzilla.gnome.org/show_bug.cgi?id=744722
This commit is contained in:
12
gio/gfile.c
12
gio/gfile.c
@@ -126,9 +126,15 @@
|
||||
* the operation, producing a GAsyncResult which is then passed to the
|
||||
* function's matching _finish() operation.
|
||||
*
|
||||
* Some #GFile operations do not have synchronous analogs, as they may
|
||||
* take a very long time to finish, and blocking may leave an application
|
||||
* unusable. Notable cases include:
|
||||
* It is highly recommended to use asynchronous calls when running within a
|
||||
* shared main loop, such as in the main thread of an application. This avoids
|
||||
* I/O operations blocking other sources on the main loop from being dispatched.
|
||||
* Synchronous I/O operations should be performed from worker threads. See the
|
||||
* [introduction to asynchronous programming section][async-programming] for
|
||||
* more.
|
||||
*
|
||||
* Some #GFile operations almost always take a noticeable amount of time, and
|
||||
* so do not have synchronous analogs. Notable cases include:
|
||||
* - g_file_mount_mountable() to mount a mountable file.
|
||||
* - g_file_unmount_mountable_with_operation() to unmount a mountable file.
|
||||
* - g_file_eject_mountable_with_operation() to eject a mountable file.
|
||||
|
Reference in New Issue
Block a user