Commit 85fb2873 authored by Mike J. Chen's avatar Mike J. Chen Committed by Carles Cufi
Browse files

logging: log_core: support CONFIG_LOG_PROCESS_TRIGGER_THRESHOLD value of 1

Previous implementation didn't work if CONFIG_LOG_PROCESS_TRIGGER_THRESHOLD
was set to 1. Minmimum value that worked was 2. A value of 1 would
just be ignored and act like 0 with threshold triggerring disabled.

Signed-off-by: default avatarMike J. Chen <mjchen@google.com>
parent e59991ab
Loading
Loading
Loading
Loading
+11 −0
Changes for subsys/logging/log_core.c: 11 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -163,6 +163,16 @@ static void z_log_msg_post_finalize(void)

		k_spin_unlock(&process_lock, key);
	} else if (proc_tid != NULL) {
		/*
		 * If CONFIG_LOG_PROCESS_TRIGGER_THRESHOLD == 1,
		 * timer is never needed. We release the processing
		 * thread after every message is posted.
		 */
		if (CONFIG_LOG_PROCESS_TRIGGER_THRESHOLD == 1) {
			if (cnt == 0) {
				k_sem_give(&log_process_thread_sem);
			}
		} else {
			if (cnt == 0) {
				k_timer_start(&log_process_thread_timer,
					      K_MSEC(CONFIG_LOG_PROCESS_THREAD_SLEEP_MS),
@@ -179,6 +189,7 @@ static void z_log_msg_post_finalize(void)
			}
		}
	}
}

const struct log_backend *log_format_set_all_active_backends(size_t log_type)
{