X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FDaemon%2FDaemon.ih;h=f6ec463483867c861d9163291811562eb90a2b15;hb=8488a803a9e1dfa293af161eb271503990d6fdd3;hp=5cfa158b8f2e87c32610967e0d81f37edf46b7b5;hpb=f73fa16ed5abdce272ac77f8b8b9ef2b9922c266;p=senf.git diff --git a/Utils/Daemon/Daemon.ih b/Utils/Daemon/Daemon.ih index 5cfa158..f6ec463 100644 --- a/Utils/Daemon/Daemon.ih +++ b/Utils/Daemon/Daemon.ih @@ -1,8 +1,8 @@ // $Id$ // -// Copyright (C) 2007 -// Fraunhofer Institute for Open Communication Systems (FOKUS) -// Competence Center NETwork research (NET), St. Augustin, GERMANY +// Copyright (C) 2007 +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund // // This program is free software; you can redistribute it and/or modify @@ -28,10 +28,12 @@ // Custom includes #include -#include +#include "../boost/intrusive/iset.hpp" +#include "../boost/intrusive/iset_hook.hpp" #include #include #include "../../Scheduler/Scheduler.hh" +#include "../../Scheduler/SignalEvent.hh" ///////////////////////////////ih.p//////////////////////////////////////// @@ -62,27 +64,41 @@ namespace detail { private: + // This is awkward ... we'll need to erase an element from the target list given + // only the target object. This is best implement using an intrusive container. + // However, this makes memory-management explicit and we'll need to be careful. typedef std::deque Buffer; - struct Target + struct TargetListTag; + typedef boost::intrusive::ilist_base_hook TargetListBase; + + struct Target : public TargetListBase { + Target(Forwarder & fwd, int fd); + int fd; Buffer::size_type offset; + scheduler::FdEvent writeevent; }; - typedef std::list Targets; + typedef boost::intrusive::ilist,false> Targets; - void readData(Scheduler::EventId event); - void writeData(Scheduler::EventId event, Targets::iterator target); + struct DestroyDelete + { + template + void operator()(T * t) { delete t; } + }; + + void readData(int event); + void writeData(int event, Target * target); Buffer buffer_; int src_; - Targets targets_; - Callback cb_; + scheduler::FdEvent readevent_; }; void pipeClosed(int id); - void sigChld(); + void sigChld(siginfo_t const &); void childDied(); void childOk(); @@ -93,6 +109,8 @@ namespace detail { int stderr_; bool sigChld_; + scheduler::SignalEvent cldSignal_; + scheduler::TimerEvent timer_; Forwarder coutForwarder_; Forwarder cerrForwarder_; };