Remix.run Logo
pjmlp a day ago

Exactly, the only safe thing to do in a signal is set a variable for other code to react on, also they completely mess up in multi-threaded code.

germandiago a day ago | parent [-]

That is exactly what I do: set an stomic variable and do yhings outside of the handler.

masklinn 18 hours ago | parent [-]

And that is pretty much what Python does for you, the Python-level signal handlers are not C signal handlers. Python sets a C signal handler to set an interpreter variable then exit, then it calls the Python level signal handler on the main thread (and on the main thread only, which can be a concern in sone cases).