summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Lotterbach <timo.lotterbach@bmw-carit.de>2014-04-07 10:59:45 +0200
committerTimo Lotterbach <timo.lotterbach@bmw-carit.de>2014-04-07 10:59:45 +0200
commit6bd6635581e8d0d7780346c65158942027b83fc6 (patch)
treeb27f0c2f702b6d1dac8b2788f115d1a390824f30
parentc3c7c0df66880abbe49d41e5bfad76eaf2e44bc3 (diff)
downloadwayland-ivi-extension-1.2.0_rc3.tar.gz
stop control thread during shutdown to prevent crashes1.2.0_rc31.2.0-rc3
unit tests do fast init/destroy cycles, which resulted in control thread still using resources (e.g. display) that were already destroyed. Signed-off-by: Timo Lotterbach <timo.lotterbach@bmw-carit.de>
-rw-r--r--ivi-layermanagement-api/ilmCommon/src/ilm_common.c5
-rw-r--r--ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c5
2 files changed, 9 insertions, 1 deletions
diff --git a/ivi-layermanagement-api/ilmCommon/src/ilm_common.c b/ivi-layermanagement-api/ilmCommon/src/ilm_common.c
index f487f79..540ebf5 100644
--- a/ivi-layermanagement-api/ilmCommon/src/ilm_common.c
+++ b/ivi-layermanagement-api/ilmCommon/src/ilm_common.c
@@ -86,5 +86,8 @@ ilm_isInitialized()
ILM_EXPORT ilmErrorTypes
ilm_destroy()
{
- return gIlmCommonPlatformFunc.destroy();
+ ilmErrorTypes retVal = gIlmCommonPlatformFunc.destroy();
+ ilmClient_destroy();
+ ilmControl_destroy(); // block until control thread is stopped
+ return retVal;
}
diff --git a/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c b/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c
index dceb0e8..4f63c39 100644
--- a/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c
+++ b/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c
@@ -1429,6 +1429,11 @@ wayland_destroy()
{
struct ilm_control_context *ctx = &ilm_context;
ctx->valid = 0;
+ void* threadRetVal = NULL;
+ pthread_cancel(ctx->thread);
+ if (0 != pthread_join(ctx->thread, &threadRetVal)) {
+ fprintf(stderr, "failed to join control thread\n");
+ }
}
static void