From 1dee1ba64e52394446e8aa67a8418f066257a9a2 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Fri, 11 Nov 2016 20:22:39 -0500 Subject: queuelogger: Add support for background log writing Writing to the debug log can cause an unbounded delay due to disk IO. This is particularly so on embedded machines such as the Raspberry Pi that run on SD cards. These log writing delays can cause problems for the main processing threads. The new "queuelogger" code forwards all the main thread log messages to a queue, and a background thread writes the log messages from the queue to the destination file. This eliminates the IO delay from the main threads. Signed-off-by: Kevin O'Connor --- docs/Code_Overview.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'docs/Code_Overview.md') diff --git a/docs/Code_Overview.md b/docs/Code_Overview.md index 1522c60b..207b37f4 100644 --- a/docs/Code_Overview.md +++ b/docs/Code_Overview.md @@ -98,9 +98,11 @@ printer object calls, which frequently translate the actions to commands to be executed on the micro-controller (as declared via the DECL_COMMAND macro in the micro-controller code). -There are three threads in the Klippy host code. The main thread +There are four threads in the Klippy host code. The main thread handles incoming gcode commands. A second thread (which resides entirely in the **klippy/serialqueue.c** C code) handles low-level IO with the serial port. The third thread is used to process response messages from the micro-controller in the Python code (see -**klippy/serialhdl.py**). +**klippy/serialhdl.py**). The fourth thread writes debug messages to +the log (see **klippy/queuelogger.py**) so that the other threads +never block on log writes. -- cgit v1.2.3-70-g09d2