did part of signals

This commit is contained in:
ronny abraham 2025-06-12 18:39:56 +03:00
parent 875eaa811b
commit f20aeb33e5

View file

@ -10,7 +10,7 @@
- [[https://www.youtube.com/playlist?list=PLyzOVJj3bHQuloKGG59rS43e29ro7I57J][Playlist: Missing Semester]] - [[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]] - [[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 *** timestamps
:PROPERTIES: :PROPERTIES:
@ -52,3 +52,26 @@
*** Ctrl-C *** Ctrl-C
- sends SIGINT - signal interrupt - sends SIGINT - signal interrupt
- man signal will show the list of signals - 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