[gjs/gnome-40: 20/30] gjs-test-tools: Return GThread's when we don't join immediately
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/gnome-40: 20/30] gjs-test-tools: Return GThread's when we don't join immediately
- Date: Wed, 5 May 2021 20:41:26 +0000 (UTC)
commit 58df11b3e5e20083b8cd5fb3bee5430bcab7a78b
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Thu Apr 29 06:18:18 2021 +0200
gjs-test-tools: Return GThread's when we don't join immediately
In this way we can join later in the tests or have more control on them.
(cherry-picked from commit 8d77b058)
.../js/libgjstesttools/gjs-test-tools.cpp | 37 +++++++++++++++-------
.../js/libgjstesttools/gjs-test-tools.h | 9 +++---
2 files changed, 30 insertions(+), 16 deletions(-)
---
diff --git a/installed-tests/js/libgjstesttools/gjs-test-tools.cpp
b/installed-tests/js/libgjstesttools/gjs-test-tools.cpp
index 3cd0e2cf..43357258 100644
--- a/installed-tests/js/libgjstesttools/gjs-test-tools.cpp
+++ b/installed-tests/js/libgjstesttools/gjs-test-tools.cpp
@@ -156,22 +156,35 @@ void gjs_test_tools_unref_other_thread(GObject* object) {
ref_thread_data_new(object, -1, UNREF)));
}
-void gjs_test_tools_delayed_ref_other_thread(GObject* object, int interval) {
- g_thread_unref(g_thread_new("ref_object", ref_thread_func,
- ref_thread_data_new(object, interval, REF)));
+/**
+ * gjs_test_tools_delayed_ref_other_thread:
+ * Returns: (transfer full)
+ */
+GThread* gjs_test_tools_delayed_ref_other_thread(GObject* object,
+ int interval) {
+ return g_thread_new("ref_object", ref_thread_func,
+ ref_thread_data_new(object, interval, REF));
}
-void gjs_test_tools_delayed_unref_other_thread(GObject* object, int interval) {
- g_thread_unref(g_thread_new("unref_object", ref_thread_func,
- ref_thread_data_new(object, interval, UNREF)));
+/**
+ * gjs_test_tools_delayed_unref_other_thread:
+ * Returns: (transfer full)
+ */
+GThread* gjs_test_tools_delayed_unref_other_thread(GObject* object,
+ int interval) {
+ return g_thread_new("unref_object", ref_thread_func,
+ ref_thread_data_new(object, interval, UNREF));
}
-void gjs_test_tools_delayed_ref_unref_other_thread(GObject* object,
- int interval) {
- g_thread_unref(
- g_thread_new("ref_unref_object", ref_thread_func,
- ref_thread_data_new(object, interval,
- static_cast<RefType>(REF | UNREF))));
+/**
+ * gjs_test_tools_delayed_ref_unref_other_thread:
+ * Returns: (transfer full)
+ */
+GThread* gjs_test_tools_delayed_ref_unref_other_thread(GObject* object,
+ int interval) {
+ return g_thread_new("ref_unref_object", ref_thread_func,
+ ref_thread_data_new(object, interval,
+ static_cast<RefType>(REF | UNREF)));
}
void gjs_test_tools_run_dispose_other_thread(GObject* object) {
diff --git a/installed-tests/js/libgjstesttools/gjs-test-tools.h
b/installed-tests/js/libgjstesttools/gjs-test-tools.h
index 89f28b7c..20f439a5 100644
--- a/installed-tests/js/libgjstesttools/gjs-test-tools.h
+++ b/installed-tests/js/libgjstesttools/gjs-test-tools.h
@@ -35,17 +35,18 @@ _GJS_TEST_TOOL_EXTERN
void gjs_test_tools_ref_other_thread(GObject* object);
_GJS_TEST_TOOL_EXTERN
-void gjs_test_tools_delayed_ref_other_thread(GObject* object, int interval);
+GThread* gjs_test_tools_delayed_ref_other_thread(GObject* object, int interval);
_GJS_TEST_TOOL_EXTERN
void gjs_test_tools_unref_other_thread(GObject* object);
_GJS_TEST_TOOL_EXTERN
-void gjs_test_tools_delayed_unref_other_thread(GObject* object, int interval);
+GThread* gjs_test_tools_delayed_unref_other_thread(GObject* object,
+ int interval);
_GJS_TEST_TOOL_EXTERN
-void gjs_test_tools_delayed_ref_unref_other_thread(GObject* object,
- int interval);
+GThread* gjs_test_tools_delayed_ref_unref_other_thread(GObject* object,
+ int interval);
_GJS_TEST_TOOL_EXTERN
void gjs_test_tools_run_dispose_other_thread(GObject* object);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]