[gtk/widgetfactory-async-load: 3/4] texture: Document constructors as threadsafe




commit 0b9f6985b1a255fc044e1eb279c19ff62406eb0b
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Sep 21 23:08:09 2021 -0400

    texture: Document constructors as threadsafe
    
    We aren't providing async loading apis here,
    but we want to allow applications to create
    textures in a thread, to avoid blocking the
    main thread.

 gdk/gdktexture.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
---
diff --git a/gdk/gdktexture.c b/gdk/gdktexture.c
index 3f602cc5cc..e04adfbb33 100644
--- a/gdk/gdktexture.c
+++ b/gdk/gdktexture.c
@@ -409,6 +409,10 @@ gdk_texture_new_for_surface (cairo_surface_t *surface)
  *
  * Creates a new texture object representing the `GdkPixbuf`.
  *
+ * This function is threadsafe, so that you can e.g. use GTask
+ * and g_task_run_in_thread() to avoid blocking the main thread
+ * while loading a big image.
+ *
  * Returns: a new `GdkTexture`
  */
 GdkTexture *
@@ -451,6 +455,10 @@ gdk_texture_new_for_pixbuf (GdkPixbuf *pixbuf)
  * If you are unsure about the validity of a resource, use
  * [ctor@Gdk.Texture.new_from_file] to load it.
  *
+ * This function is threadsafe, so that you can e.g. use GTask
+ * and g_task_run_in_thread() to avoid blocking the main thread
+ * while loading a big image.
+ *
  * Return value: A newly-created `GdkTexture`
  */
 GdkTexture *
@@ -489,6 +497,10 @@ gdk_texture_new_from_resource (const char *resource_path)
  *
  * If %NULL is returned, then @error will be set.
  *
+ * This function is threadsafe, so that you can e.g. use GTask
+ * and g_task_run_in_thread() to avoid blocking the main thread
+ * while loading a big image.
+ *
  * Return value: A newly-created `GdkTexture`
  */
 GdkTexture *
@@ -578,6 +590,10 @@ gdk_texture_new_from_bytes_pixbuf (GBytes  *bytes,
  *
  * If %NULL is returned, then @error will be set.
  *
+ * This function is threadsafe, so that you can e.g. use GTask
+ * and g_task_run_in_thread() to avoid blocking the main thread
+ * while loading a big image.
+ *
  * Return value: A newly-created `GdkTexture`
  *
  * Since: 4.6
@@ -620,6 +636,10 @@ gdk_texture_new_from_bytes (GBytes  *bytes,
  *
  * If %NULL is returned, then @error will be set.
  *
+ * This function is threadsafe, so that you can e.g. use GTask
+ * and g_task_run_in_thread() to avoid blocking the main thread
+ * while loading a big image.
+ *
  * Return value: A newly-created `GdkTexture`
  */
 GdkTexture *


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