summaryrefslogtreecommitdiff
path: root/src/lib/dlt_user.c
diff options
context:
space:
mode:
authorAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>2013-12-06 09:04:21 +0100
committerAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>2014-01-10 07:15:59 +0100
commit5475db8bde06d1c45498293f383665f26de7ca1e (patch)
tree4e9ae630d982eaf53a22533a8bd12c3e18a2f2cb /src/lib/dlt_user.c
parentf32a86f4ff92cd40005807488ad4281ba6958bf1 (diff)
downloadDLT-daemon-5475db8bde06d1c45498293f383665f26de7ca1e.tar.gz
Fix deadlock in dlt_user_log_reattach_to_daemon(void).
Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
Diffstat (limited to 'src/lib/dlt_user.c')
-rw-r--r--src/lib/dlt_user.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/dlt_user.c b/src/lib/dlt_user.c
index 40e7cf9..e62131e 100644
--- a/src/lib/dlt_user.c
+++ b/src/lib/dlt_user.c
@@ -3819,16 +3819,24 @@ void dlt_user_log_reattach_to_daemon(void)
handle.log_level_pos = num;
log_new.context_description = dlt_user.dlt_ll_ts[num].context_description;
+ // Release the mutex for sending context registration:
+ // function dlt_user_log_send_register_context() can take the mutex to write to the DLT buffer. => dead lock
+ DLT_SEM_FREE();
+
log_new.log_level = DLT_USER_LOG_LEVEL_NOT_SET;
log_new.trace_status = DLT_USER_TRACE_STATUS_NOT_SET;
if (dlt_user_log_send_register_context(&log_new)==-1)
{
- DLT_SEM_FREE();
return;
}
reregistered=1;
+
+ // Lock again the mutex
+ // it is necessary in the for(;;) test, in order to have coherent dlt_user data all over the critical section.
+ DLT_SEM_LOCK();
+
}
}