diff options
author | Volodymyr Brynza <v.brynza@samsung.com> | 2017-02-27 14:34:06 +0200 |
---|---|---|
committer | Volodymyr Brynza <v.brynza@samsung.com> | 2017-02-27 14:34:06 +0200 |
commit | 6034dbea9f0688b07c36e652b6e71c72e07f47a4 (patch) | |
tree | bdd92d5e800e3b1a085586f588d3b84dd38cd0d5 | |
parent | 6b6c10334fe64dbbcf68c8c722ea74f97960e56c (diff) | |
download | murphy-6034dbea9f0688b07c36e652b6e71c72e07f47a4.tar.gz murphy-6034dbea9f0688b07c36e652b6e71c72e07f47a4.tar.bz2 murphy-6034dbea9f0688b07c36e652b6e71c72e07f47a4.zip |
Change glib thread creation function to prevent crash in stress testing
Change-Id: I3712b9e397a9b7fc53426ddc378276e02b29062e
Signed-off-by: Volodymyr Brynza <v.brynza@samsung.com>
-rw-r--r-- | packaging/murphy.spec | 2 | ||||
-rw-r--r-- | src/common/glib-glue.c | 10 |
2 files changed, 9 insertions, 3 deletions
diff --git a/packaging/murphy.spec b/packaging/murphy.spec index 6276f63..6183019 100644 --- a/packaging/murphy.spec +++ b/packaging/murphy.spec @@ -29,7 +29,7 @@ Summary: Resource policy framework Name: murphy Version: 0.0.74 -Release: 6 +Release: 7 License: BSD-2.0 Group: System/Service URL: http://01.org/murphy/ diff --git a/src/common/glib-glue.c b/src/common/glib-glue.c index 68cc1df..21f3dfb 100644 --- a/src/common/glib-glue.c +++ b/src/common/glib-glue.c @@ -448,8 +448,14 @@ int mrp_mainloop_register_with_glib(mrp_mainloop_t *ml, GMainLoop *gml) * glue context isn't default */ GMainContext *def_ctx = g_main_context_default(); GMainContext *loop_ctx = g_main_loop_get_context(glue->gml); - if (loop_ctx && def_ctx != loop_ctx) - glue->worker = g_thread_new(NULL, thread_main, glue); + if (loop_ctx && def_ctx != loop_ctx) { + glue->worker = g_thread_try_new(NULL, thread_main, glue, NULL); + if (glue->worker == NULL) { + g_main_loop_unref(gml); + mrp_free(glue); + return FALSE; + } + } return TRUE; } else { |