←back to thread

345 points splitbrain | 3 comments | | HN request time: 0.612s | source
1. yazzku ◴[] No.41839476[source]
Can you not use std::condition_variable to avoid the active waiting of the signal?
replies(2): >>41840920 #>>41842565 #
2. quotemstr ◴[] No.41840920[source]
signalfd or ppoll or a million other options
3. listeria ◴[] No.41842565[source]
I don't know if std::condition_variable is async-signal safe, but an easy fix is to replace the sleeping with pause(2). There's also sigwait(3), which wouldn't need a signal handler.