<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Hacker News: tyffanypastecf</title><link>https://news.ycombinator.com/user?id=tyffanypastecf</link><description>Hacker News RSS</description><docs>https://hnrss.org/</docs><generator>hnrss v2.1.1</generator><lastBuildDate>Fri, 04 Sep 2026 10:17:48 +0000</lastBuildDate><atom:link href="https://hnrss.org/user?id=tyffanypastecf" rel="self" type="application/rss+xml"></atom:link><item><title><![CDATA[New comment by tyffanypastecf in "Is it safe to call print in a Python signal handler?"]]></title><description><![CDATA[
<p>Self-pipe, yeah, except in Python you don't have to build it. signal.set_wakeup_fd() is exactly that: hand it an fd (or a socket on Windows) and the interpreter writes the signal number to it. Then you select/poll that fd in your normal loop and do the actual work outside the handler. asyncio uses it under the hood for add_signal_handler.<p>The other one that plays nicely with threads is blocking the signals everywhere with pthread_sigmask and parking one dedicated thread in sigwait(). Both are in the stdlib on Unix.<p>signalfd is nicer than either but it's Linux only, which is why set_wakeup_fd usually wins if you care about portability.</p>
]]></description><pubDate>Sun, 30 Aug 2026 07:22:54 +0000</pubDate><link>https://news.ycombinator.com/item?id=49496462</link><dc:creator>tyffanypastecf</dc:creator><comments>https://news.ycombinator.com/item?id=49496462</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=49496462</guid></item></channel></rss>