mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-18 07:06:18 +00:00
added SA_RESTART to automatically restart system calls interrupted by signals (as was already done by signal()) as well as error checking on sigaction()
This commit is contained in:
@@ -76,12 +76,13 @@ SignalHandler::set_handler(unsigned int signum, Slot slot) {
|
|||||||
|
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
sigemptyset(&sa.sa_mask);
|
sigemptyset(&sa.sa_mask);
|
||||||
sa.sa_flags = 0;
|
sa.sa_flags = SA_RESTART;
|
||||||
sa.sa_handler = &SignalHandler::caught;
|
sa.sa_handler = &SignalHandler::caught;
|
||||||
|
|
||||||
sigaction(signum, &sa, NULL);
|
if (sigaction(signum, &sa, NULL) == -1)
|
||||||
|
throw std::logic_error("Could not set sigaction: " + std::string(rak::error_number::current().c_str()));
|
||||||
m_handlers[signum] = slot;
|
else
|
||||||
|
m_handlers[signum] = slot;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user