Skip to content

Commit

Permalink
trace-load: protect settings with rwlock
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Mohr <[email protected]>
  • Loading branch information
alexmohr committed Sep 11, 2024
1 parent 6aaae63 commit d78e264
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/lib/dlt_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -4159,19 +4159,22 @@ DltReturnValue dlt_user_log_send_log(DltContextData *log, const int mtype, int *
/* check trace load before output */
if (!sent_size)
{
// need rw protection, because dlt_check_trace_load
// will modify the trace load stats in the settings.
pthread_rwlock_rwlock(&trace_load_rw_lock);
DltTraceLoadSettings* settings =
dlt_find_runtime_trace_load_settings(
trace_load_settings, trace_load_settings_count, dlt_user.appID, log->handle->contextID);

if (!dlt_check_trace_load(
const auto trace_load_in_limits = dlt_check_trace_load(
settings,
log->log_level, time_stamp,
sizeof(DltUserHeader)
+ msg.headersize - sizeof(DltStorageHeader)
+ log->size,
dlt_user_output_internal_msg,
NULL))
{
NULL);
pthread_rwlock_unlock(&trace_load_rw_lock);
if (!trace_load_in_limits){
return DLT_RETURN_LOAD_EXCEEDED;
}
}
Expand Down

0 comments on commit d78e264

Please sign in to comment.