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>
ILM_EXPORT ilmErrorTypes
ilm_destroy()
{
- return gIlmCommonPlatformFunc.destroy();
+ ilmErrorTypes retVal = gIlmCommonPlatformFunc.destroy();
+ ilmClient_destroy();
+ ilmControl_destroy(); // block until control thread is stopped
+ return retVal;
}
{
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