[gnome-builder] directory: add notes about thread safety
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] directory: add notes about thread safety
- Date: Sat, 14 Oct 2017 00:03:08 +0000 (UTC)
commit 33a7edc58d9c4c7a1545211c9892d53802b43a97
Author: Christian Hergert <chergert redhat com>
Date: Fri Oct 13 16:34:41 2017 -0700
directory: add notes about thread safety
Certainly functions must remain thread-safe, and we should
document those so we don't break that invariant later.
src/libide/directory/ide-directory-vcs.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/libide/directory/ide-directory-vcs.c b/src/libide/directory/ide-directory-vcs.c
index 7d2c894..4327fcf 100644
--- a/src/libide/directory/ide-directory-vcs.c
+++ b/src/libide/directory/ide-directory-vcs.c
@@ -62,6 +62,12 @@ ide_directory_vcs_get_working_directory (IdeVcs *vcs)
g_return_val_if_fail (IDE_IS_DIRECTORY_VCS (vcs), NULL);
+ /* Note: This function is expected to be thread-safe for
+ * those holding a reference to @vcs. So
+ * @working_directory cannot be changed after creation
+ * and must be valid for the lifetime of @vcs.
+ */
+
return self->working_directory;
}
@@ -177,6 +183,11 @@ ide_directory_vcs_init_worker (GTask *task,
file_type = g_file_info_get_file_type (file_info);
+ /*
+ * Note: Working directory may only be setup creation time of
+ * the vcs. So we set it in our GAsyncInitable worker only.
+ */
+
if (file_type == G_FILE_TYPE_DIRECTORY)
self->working_directory = g_object_ref (file);
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]