[gnome-software: 30/38] fedora-pkgdb-collections: Add comments about mutex use and lifetimes




commit ebb5b58da8468f326010d21c2825dc3c36b7117a
Author: Philip Withnall <pwithnall endlessos org>
Date:   Wed Mar 2 14:10:13 2022 +0000

    fedora-pkgdb-collections: Add comments about mutex use and lifetimes
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>
    
    Helps: #1472

 .../gs-plugin-fedora-pkgdb-collections.c               | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/plugins/fedora-pkgdb-collections/gs-plugin-fedora-pkgdb-collections.c 
b/plugins/fedora-pkgdb-collections/gs-plugin-fedora-pkgdb-collections.c
index 1e49472ff..e07eee48a 100644
--- a/plugins/fedora-pkgdb-collections/gs-plugin-fedora-pkgdb-collections.c
+++ b/plugins/fedora-pkgdb-collections/gs-plugin-fedora-pkgdb-collections.c
@@ -30,14 +30,18 @@
 struct _GsPluginFedoraPkgdbCollections {
        GsPlugin         parent;
 
-       gchar           *cachefn;
-       GFileMonitor    *cachefn_monitor;
-       gchar           *os_name;
+       /* Only set at setup time, then read only: */
+       gchar           *cachefn;  /* (owned) (not nullable) */
+       GFileMonitor    *cachefn_monitor;  /* (owned) (not nullable) */
+       gchar           *os_name;  /* (owned) (not nullable) */
        guint64          os_version;
-       GsApp           *cached_origin;
-       GSettings       *settings;
-       gboolean         is_valid;
-       GPtrArray       *distros;
+       GsApp           *cached_origin;  /* (owned) (not nullable) */
+       GSettings       *settings;  /* (owned) (not nullable) */
+
+       /* Contents may vary throughout the plugin’s lifetime, and hence must
+        * be accessed with @mutex held: */
+       gboolean         is_valid;  /* (mutex mutex) */
+       GPtrArray       *distros;  /* (owned) (not nullable) (element-type PkgdbItem) (mutex mutex) */
        GMutex           mutex;
 };
 


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