2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
15 \brief FdDispatcher internal header */
17 #ifndef IH_SENF_Scheduler_FdEvent_
18 #define IH_SENF_Scheduler_FdEvent_ 1
21 #include <boost/intrusive/set.hpp>
23 //-/////////////////////////////////////////////////////////////////////////////////////////////////
33 bool operator()(FdEvent const & a, FdEvent const & b) const
34 { return a.fd_ < b.fd_; }
38 : public senf::singleton<FdDispatcher>
41 using senf::singleton<FdDispatcher>::instance;
42 using senf::singleton<FdDispatcher>::alive;
44 bool add(FdEvent & event);
45 void remove(FdEvent & event);
55 typedef boost::intrusive::multiset< FdEvent,
56 boost::intrusive::constant_time_size<false>,
57 boost::intrusive::compare<FdSetCompare>,
58 boost::intrusive::base_hook<FdSetBase> > FdSet;
62 friend void senf::scheduler::restart();
63 friend class singleton<FdDispatcher>;
64 friend class senf::scheduler::FdEvent;
68 : public senf::singleton<FileDispatcher>
71 using senf::singleton<FileDispatcher>::instance;
72 using senf::singleton<FileDispatcher>::alive;
74 void add(FdEvent & event);
75 void remove(FdEvent & event);
79 // Called by IdleEventDispatcher
91 // We really only need a list here but we need to use the same event structure used by
93 typedef boost::intrusive::multiset< FdEvent,
94 boost::intrusive::constant_time_size<false>,
95 boost::intrusive::compare<FdSetCompare>,
96 boost::intrusive::base_hook<FdSetBase> > FdSet;
101 friend void senf::scheduler::restart();
102 friend class singleton<FileDispatcher>;
105 template <class Handle>
106 int get_descriptor(Handle const & handle);
108 int retrieve_filehandle(int fd);
112 //-/////////////////////////////////////////////////////////////////////////////////////////////////
119 // comment-column: 40
120 // c-file-style: "senf"
121 // indent-tabs-mode: nil
122 // ispell-local-dictionary: "american"
123 // compile-command: "scons -u test"