// $Id$
//
// Copyright (C) 2006
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
-// Stefan Bund <stefan.bund@fokus.fraunhofer.de>
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
+// Stefan Bund <g0dil@berlios.de>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
/** \file
\brief Scheduler non-inline non-template implementation
- \idea Implement signal handling (See source for more discussion
- about this)
-
\idea Multithreading support: To support multithreading, the
static member Scheduler::instance() must return a thread-local
value (that is Scheduler::instance() must allocate one Scheduler
//#include "Scheduler.ih"
// Custom includes
+#include "../Utils/senfassert.hh"
#include <errno.h>
#include <sys/epoll.h>
#include <unistd.h>
eventTime_(0), eventEarly_(ClockService::milliseconds(11)), eventAdjust_(0)
{
if (epollFd_<0)
- throw SystemException(errno);
+ throw SystemException();
if (::pipe(sigpipe_) < 0)
- throw SystemException(errno);
+ throw SystemException();
int flags (::fcntl(sigpipe_[1],F_GETFL));
if (flags < 0)
- throw SystemException(errno);
+ throw SystemException();
flags |= O_NONBLOCK;
if (::fcntl(sigpipe_[1], F_SETFL, flags) < 0)
- throw SystemException(errno);
+ throw SystemException();
::epoll_event ev;
::memset(&ev, 0, sizeof(ev));
ev.events = EV_READ;
ev.data.fd = sigpipe_[0];
if (::epoll_ctl(epollFd_, EPOLL_CTL_ADD, sigpipe_[0], &ev) < 0)
- throw SystemException(errno);
+ throw SystemException();
}
prefix_ void senf::Scheduler::registerSignal(unsigned signal, SimpleCallback const & cb)
++ files_;
}
else
- throwErrno("::epoll_ctl()");
+ throw SystemException("::epoll_ctl()");
}
}
}
if (! file && epoll_ctl(epollFd_, action, fd, &ev) < 0)
- throwErrno("::epoll_ctl()");
+ throw SystemException("::epoll_ctl()");
if (file)
-- files_;
}
if (signal == SIGCHLD)
sa.sa_flags |= SA_NOCLDSTOP;
if (::sigaction(signal, &sa, 0) < 0)
- throw SystemException(errno);
+ throw SystemException();
}
}
}
if (events<0)
if (errno != EINTR)
- throw SystemException(errno);
+ throw SystemException();
eventTime_ = ClockService::now();
if (mask & EPOLLERR) extraFlags |= EV_ERR;
if (mask & EPOLLIN) {
- BOOST_ASSERT(spec.cb_read);
+ SENF_ASSERT(spec.cb_read);
spec.cb_read(EventId(EV_READ | extraFlags));
}
else if (mask & EPOLLPRI) {
- BOOST_ASSERT(spec.cb_prio);
+ SENF_ASSERT(spec.cb_prio);
spec.cb_prio(EventId(EV_PRIO | extraFlags));
}
else if (mask & EPOLLOUT) {
- BOOST_ASSERT(spec.cb_write);
+ SENF_ASSERT(spec.cb_write);
spec.cb_write(EventId(EV_WRITE | extraFlags));
}
else {