mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-17 23:52:30 +00:00
Converted sigc++ slots to std::tr1::function.
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
//extern "C" void (*signal (int sig, void (*disp)(int)))(int);
|
||||
#endif
|
||||
|
||||
SignalHandler::Slot SignalHandler::m_handlers[HIGHEST_SIGNAL];
|
||||
SignalHandler::slot_void SignalHandler::m_handlers[HIGHEST_SIGNAL];
|
||||
|
||||
void
|
||||
SignalHandler::set_default(unsigned int signum) {
|
||||
@@ -54,7 +54,7 @@ SignalHandler::set_default(unsigned int signum) {
|
||||
throw std::logic_error("SignalHandler::set_default(...) received invalid signal value.");
|
||||
|
||||
signal(signum, SIG_DFL);
|
||||
m_handlers[signum].disconnect();
|
||||
m_handlers[signum] = slot_void();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -63,15 +63,15 @@ SignalHandler::set_ignore(unsigned int signum) {
|
||||
throw std::logic_error("SignalHandler::set_ignore(...) received invalid signal value.");
|
||||
|
||||
signal(signum, SIG_IGN);
|
||||
m_handlers[signum].disconnect();
|
||||
m_handlers[signum] = slot_void();
|
||||
}
|
||||
|
||||
void
|
||||
SignalHandler::set_handler(unsigned int signum, Slot slot) {
|
||||
SignalHandler::set_handler(unsigned int signum, slot_void slot) {
|
||||
if (signum > HIGHEST_SIGNAL)
|
||||
throw std::logic_error("SignalHandler::set_handler(...) received invalid signal value.");
|
||||
|
||||
if (slot.empty())
|
||||
if (!slot)
|
||||
throw std::logic_error("SignalHandler::set_handler(...) received an empty slot.");
|
||||
|
||||
signal(signum, &SignalHandler::caught);
|
||||
@@ -98,7 +98,7 @@ SignalHandler::caught(int signum) {
|
||||
if ((unsigned)signum > HIGHEST_SIGNAL)
|
||||
throw std::logic_error("SignalHandler::caught(...) received invalid signal from the kernel, bork bork bork.");
|
||||
|
||||
if (m_handlers[signum].empty())
|
||||
if (!m_handlers[signum])
|
||||
throw std::logic_error("SignalHandler::caught(...) received a signal we don't have a handler for.");
|
||||
|
||||
m_handlers[signum]();
|
||||
|
||||
Reference in New Issue
Block a user