[gnome-builder/gnome-builder-43] plugins/podman: check-lock-check for atomic bit



commit 843b6f764e5c1f7b01b6788fb25340b2544c74d7
Author: Christian Hergert <chergert redhat com>
Date:   Tue Sep 20 14:51:05 2022 -0700

    plugins/podman: check-lock-check for atomic bit

 src/plugins/podman/gbp-podman-runtime.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/src/plugins/podman/gbp-podman-runtime.c b/src/plugins/podman/gbp-podman-runtime.c
index 240213e13..aceaa7dd1 100644
--- a/src/plugins/podman/gbp-podman-runtime.c
+++ b/src/plugins/podman/gbp-podman-runtime.c
@@ -37,8 +37,9 @@ struct _GbpPodmanRuntime
   JsonObject *object;
   gchar      *id;
   GMutex      mutex;
-  guint       has_started : 1;
   GList      *layers;
+
+  gboolean    has_started;
 };
 
 G_DEFINE_FINAL_TYPE (GbpPodmanRuntime, gbp_podman_runtime, IDE_TYPE_RUNTIME)
@@ -57,6 +58,9 @@ maybe_start (GbpPodmanRuntime *self)
 
   g_mutex_lock (&self->mutex);
 
+  if (g_atomic_int_get (&self->has_started))
+    goto unlock;
+
   launcher = ide_subprocess_launcher_new (G_SUBPROCESS_FLAGS_STDERR_SILENCE |
                                           G_SUBPROCESS_FLAGS_STDOUT_SILENCE);
   ide_subprocess_launcher_set_run_on_host (launcher, TRUE);
@@ -70,6 +74,7 @@ maybe_start (GbpPodmanRuntime *self)
       self->has_started = TRUE;
     }
 
+unlock:
   g_mutex_unlock (&self->mutex);
 }
 


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