[gjs/wip/3v1n0/toggle-queue-tests: 2/15] 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/wip/3v1n0/toggle-queue-tests: 2/15] gjs-test-tools: Return GThread's when we don't join immediately
- Date: Tue, 4 May 2021 04:39:07 +0000 (UTC)
commit 8d77b058076b2a9f304d43afa96fd71e5fa03afa
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.
.../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 c7d0f583..f50643a3 100644
--- a/installed-tests/js/libgjstesttools/gjs-test-tools.cpp
+++ b/installed-tests/js/libgjstesttools/gjs-test-tools.cpp
@@ -165,22 +165,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 0e1595bc..57388cbe 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]