From f20aeb33e583888b7b3d993064192d7f049096f3 Mon Sep 17 00:00:00 2001 From: ronny abraham Date: Thu, 12 Jun 2025 18:39:56 +0300 Subject: [PATCH] did part of signals --- _subsections/lesson-05.org | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/_subsections/lesson-05.org b/_subsections/lesson-05.org index 7d63862..0086e7c 100644 --- a/_subsections/lesson-05.org +++ b/_subsections/lesson-05.org @@ -10,7 +10,7 @@ - [[https://www.youtube.com/playlist?list=PLyzOVJj3bHQuloKGG59rS43e29ro7I57J][Playlist: Missing Semester]] - [[https://www.youtube.com/redirect?event=video_description&redir_token=QUFFLUhqbVVJc2RzZ25nMmlrVW5zVGRsTS1fX2ladmRPQXxBQ3Jtc0ttWjQ5Ujcyd19TekNncTZGNEp1eDc3RWhzTzhvMW9oSTFoUl9JbGt1Mi0yU3FLc00wVUx1UXNJdFQxTjBjMWphdUZxNnU1WUYzTmFqd3RRemNLUDBJMlZkV3B0SnB4RVhpaUhvWWtnc1RISW1WVzdYWQ&q=https%3A%2F%2Fmissing.csail.mit.edu%2F2020%2Fcommand-line%2F&v=e8BO_dYxk5c][class notes]] -- Curr: https://youtu.be/sz_dsktIjt4?si=XopbHGTFXY-I6Bkh&t=2577 +- Curr: https://youtu.be/e8BO_dYxk5c?si=G0txrxbY4pmEy04y&t=510 *** timestamps :PROPERTIES: @@ -52,3 +52,26 @@ *** Ctrl-C - sends SIGINT - signal interrupt - man signal will show the list of signals + +** signals +- SIGQUIT :: signal sent when we want to quit +- SIGTERM :: similar to quit but not in term +- SIGHUP :: when we have processes running but still want to close + +*** pausing +- SIGSTOP :: pause execution of program +- SIGCONT :: continue program + +*** python library +- use import signal + +#+BEGIN_SRC python +import signal +def handler(signum, frame): + printf("signal received") + +signal.signal(signal.SIGINT, handler) +#+END_SRC + +- the above would catch a Ctrl-C and run it through handler +- you use this by catching a Ctrl-C and running any saves or cleanup before exiting