From 58bc5522950054589931657b75496f3f8ec5ce86 Mon Sep 17 00:00:00 2001
From: g0dil <g0dil@wiback.org>
Date: Fri, 4 Apr 2008 14:34:52 +0000
Subject: [PATCH] Scheduler: Remove unneeded Socket dependency Scheduler: Fix
 documentation (main page) Socket/Protocols: return ClockService::clock_type
 from timestamp() Add 'Scheduler' library dependency to every user of the
 'Socket' library

---
 Examples/RateStuffer/SConscript            |  2 +-
 Examples/TCPClientServer/SConscript        |  4 ++--
 Examples/UDPClientServer/SConscript        |  4 ++--
 Scheduler/Mainpage.dox                     | 26 +++++++++-------------
 Scheduler/SConscript                       |  2 +-
 Socket/Protocols/DVB/SConscript            |  2 +-
 Socket/Protocols/DatagramSocketProtocol.cc |  4 ++--
 Socket/Protocols/DatagramSocketProtocol.hh |  8 ++++++-
 Socket/Protocols/INet/SConscript           |  2 +-
 Socket/Protocols/Raw/SConscript            |  2 +-
 Socket/Protocols/SConscript                |  2 +-
 Socket/Protocols/UN/SConscript             |  2 +-
 Socket/SConscript                          |  2 +-
 13 files changed, 32 insertions(+), 30 deletions(-)

diff --git a/Examples/RateStuffer/SConscript b/Examples/RateStuffer/SConscript
index dec0b304d..8c36a25cc 100644
--- a/Examples/RateStuffer/SConscript
+++ b/Examples/RateStuffer/SConscript
@@ -4,7 +4,7 @@ import SENFSCons
 ###########################################################################
 
 SENFSCons.Binary( env, 'ratestuffer', SENFSCons.GlobSources(),
-                  LIBS = [ 'PPI', 'Scheduler', 'Packets', 'Socket', 'Utils' ] );
+                  LIBS = [ 'PPI', 'Scheduler', 'Packets', 'Socket', 'Scheduler', 'Utils' ] );
 
 SENFSCons.Doxygen(env, extra_sources=[
     env.Dia2Png('ratestuffer.dia')
diff --git a/Examples/TCPClientServer/SConscript b/Examples/TCPClientServer/SConscript
index 5cb8fd552..aed8d3014 100644
--- a/Examples/TCPClientServer/SConscript
+++ b/Examples/TCPClientServer/SConscript
@@ -4,7 +4,7 @@ import SENFSCons
 ###########################################################################
 
 SENFSCons.Binary(env, 'client', 'client.cc',
-                LIBS = [ 'Packets', 'Socket', 'Utils' ]);
+                LIBS = [ 'Packets', 'Socket', 'Scheduler', 'Utils' ]);
 
 SENFSCons.Binary(env, 'server', 'server.cc',
-                LIBS = [ 'Scheduler', 'Packets', 'Socket', 'Utils' ]);
+                LIBS = [ 'Scheduler', 'Packets', 'Socket', 'Scheduler', 'Utils' ]);
diff --git a/Examples/UDPClientServer/SConscript b/Examples/UDPClientServer/SConscript
index 5c362d2af..8fffdaa70 100644
--- a/Examples/UDPClientServer/SConscript
+++ b/Examples/UDPClientServer/SConscript
@@ -4,9 +4,9 @@ import SENFSCons
 ###########################################################################
 
 SENFSCons.Binary(env, 'udpClient', 'udpClient.cc',
-                LIBS = [ 'Packets', 'Socket', 'Utils' ]);
+                LIBS = [ 'Packets', 'Socket', 'Scheduler', 'Utils' ]);
 
 SENFSCons.Binary(env, 'udpServer', 'udpServer.cc',
-                LIBS = [ 'Scheduler', 'Packets', 'Socket', 'Utils' ]);
+                LIBS = [ 'Scheduler', 'Packets', 'Socket', 'Scheduler', 'Utils' ]);
 
 SENFSCons.Doxygen(env)
diff --git a/Scheduler/Mainpage.dox b/Scheduler/Mainpage.dox
index 210335b0a..e2d5f5423 100644
--- a/Scheduler/Mainpage.dox
+++ b/Scheduler/Mainpage.dox
@@ -24,24 +24,20 @@ namespace senf {
 
 /** \mainpage The SENF Scheduler Library
 
-    The Scheduler library provides a simple yet flexible abstraction
-    of the standard asynchronous UNIX mainloop utilizing \c select or
-    \c poll. The Scheduler library is based on the highly efficient
-    (but linux specific) \c epoll() system call.
+    The Scheduler library provides a simple yet flexible abstraction of the standard asynchronous
+    UNIX mainloop utilizing \c select or \c poll. The Scheduler library is based on the highly
+    efficient (but linux specific) \c epoll() system call.
 
     The library provides
-    \li a central \ref Scheduler singleton and
-    \li \ref ReadHelper and \ref WriteHelper templates to simplify
-        common tasks.
+    \li the ClockService as a reliable high-resolution highly accurate monotonous time source
+    \li a central \ref Scheduler %singleton and
+    \li \ref ReadHelper and \ref WriteHelper templates to simplify common tasks.
 
-    In it's current incarnation, the library only supports network
-    file handles (including pipes etc) and simple timers (especially
-    it does not support asynchronous notification for on-disc file
-    transfers etc). Additional features will be added:
-    \li UNIX signal support
-    \li async IO support for local (disc) file handles
-    \li multi threading support
-    \li IPC support for multithreaded applications
+    The Scheduler supports several types of scheduling activites:
+    \li Arbitrary file descriptors (however, local disk file-handles are not guaranteed
+        non-blocking)
+    \li Timers
+    \li UNIX Signals
  */
 
 }
diff --git a/Scheduler/SConscript b/Scheduler/SConscript
index ef26f8026..3b58ec6b7 100644
--- a/Scheduler/SConscript
+++ b/Scheduler/SConscript
@@ -10,5 +10,5 @@ SENFSCons.StandardTargets(env)
 SENFSCons.Lib(env,
              library = 'Scheduler',
              sources = sources,
-             LIBS = [ 'Socket', 'Utils' ])
+             LIBS = [ 'Utils' ])
 SENFSCons.Doxygen(env)
diff --git a/Socket/Protocols/DVB/SConscript b/Socket/Protocols/DVB/SConscript
index ffad3452f..7bbb5aef8 100644
--- a/Socket/Protocols/DVB/SConscript
+++ b/Socket/Protocols/DVB/SConscript
@@ -13,7 +13,7 @@ sources = SENFSCons.GlobSources()
 allob = []
 
 allob.extend(
-    SENFSCons.Objects( env, sources = sources, LIBS = [ 'Socket', 'Utils' ] ) )
+    SENFSCons.Objects( env, sources = sources, LIBS = [ 'Socket', 'Scheduler', 'Utils' ] ) )
 
 for sc in glob.glob("*/SConscript"):
     ob = SConscript(sc)
diff --git a/Socket/Protocols/DatagramSocketProtocol.cc b/Socket/Protocols/DatagramSocketProtocol.cc
index a0ac8770f..d9ec0b468 100644
--- a/Socket/Protocols/DatagramSocketProtocol.cc
+++ b/Socket/Protocols/DatagramSocketProtocol.cc
@@ -35,13 +35,13 @@
 #define prefix_
 ///////////////////////////////cc.p////////////////////////////////////////
 
-prefix_ struct timeval senf::DatagramSocketProtocol::timestamp()
+prefix_ senf::ClockService::clock_type senf::DatagramSocketProtocol::timestamp()
     const
 {
     struct timeval tv;
     if (::ioctl(fd(), SIOCGSTAMP, &tv) < 0)
         SENF_THROW_SYSTEM_EXCEPTION("");
-    return tv;
+    return ClockService::from_timeval(tv);
 }
 
 ///////////////////////////////cc.e////////////////////////////////////////
diff --git a/Socket/Protocols/DatagramSocketProtocol.hh b/Socket/Protocols/DatagramSocketProtocol.hh
index 3bffdf1be..236d8ca40 100644
--- a/Socket/Protocols/DatagramSocketProtocol.hh
+++ b/Socket/Protocols/DatagramSocketProtocol.hh
@@ -29,6 +29,7 @@
 // Custom includes
 #include <sys/time.h>
 #include "../../Socket/SocketProtocol.hh"
+#include "../../Scheduler/ClockService.hh"
 
 //#include "DatagramSocketProtocol.mpp"
 ///////////////////////////////hh.p////////////////////////////////////////
@@ -44,11 +45,16 @@ namespace senf {
         : public virtual SocketProtocol
     {
     public:
-        struct timeval timestamp() const; ///< Return packet timestamp of last packet
+        ClockService::clock_type timestamp() const; ///< Return packet timestamp of last packet
                                         /**< The returned timestamp represents the time, at which
                                              the last network packet passed to the user has been
                                              received from the network. This allows precise network
                                              timing.
+
+                                             The returned value can be converted to the
+                                             senf::ClockService::clock_type representation using
+                                             semf::ClockService::from_timeval().
+
                                              \pre The \c SO_TIMESTAMP socket option must not be set
                                                  on the socket.
                                              \returns timestamp when last packet was received */
diff --git a/Socket/Protocols/INet/SConscript b/Socket/Protocols/INet/SConscript
index a4700dd33..733c84028 100644
--- a/Socket/Protocols/INet/SConscript
+++ b/Socket/Protocols/INet/SConscript
@@ -13,7 +13,7 @@ sources = SENFSCons.GlobSources()
 allob = []
 
 allob.extend(
-    SENFSCons.Objects( env, sources = sources, LIBS = [ 'Socket', 'Utils' ] ) )
+    SENFSCons.Objects( env, sources = sources, LIBS = [ 'Socket', 'Scheduler', 'Utils' ] ) )
 
 for sc in glob.glob("*/SConscript"):
     ob = SConscript(sc)
diff --git a/Socket/Protocols/Raw/SConscript b/Socket/Protocols/Raw/SConscript
index 5e0998088..d461a08e8 100644
--- a/Socket/Protocols/Raw/SConscript
+++ b/Socket/Protocols/Raw/SConscript
@@ -13,7 +13,7 @@ sources = SENFSCons.GlobSources()
 allob = []
 
 allob.extend(
-    SENFSCons.Objects( env, sources = sources, LIBS = [ 'Socket', 'Utils' ] ) )
+    SENFSCons.Objects( env, sources = sources, LIBS = [ 'Socket', 'Scheduler', 'Utils' ] ) )
 
 for sc in glob.glob("*/SConscript"):
     ob = SConscript(sc)
diff --git a/Socket/Protocols/SConscript b/Socket/Protocols/SConscript
index 0a99e52b2..e0e2d490a 100644
--- a/Socket/Protocols/SConscript
+++ b/Socket/Protocols/SConscript
@@ -8,7 +8,7 @@ import SENFSCons, glob
 SENFSCons.StandardTargets(env)
 
 sources = SENFSCons.GlobSources()
-objects = SENFSCons.Objects( env, sources = sources, LIBS = [ 'Socket', 'Utils' ] )
+objects = SENFSCons.Objects( env, sources = sources, LIBS = [ 'Socket', 'Scheduler', 'Utils' ] )
 
 for sc in glob.glob("*/SConscript"):
     ob = SConscript(sc)
diff --git a/Socket/Protocols/UN/SConscript b/Socket/Protocols/UN/SConscript
index 6a163c1e8..b1c332fde 100644
--- a/Socket/Protocols/UN/SConscript
+++ b/Socket/Protocols/UN/SConscript
@@ -13,7 +13,7 @@ sources = SENFSCons.GlobSources()
 allob = []
 
 allob.extend(
-    SENFSCons.Objects( env, sources = sources, LIBS = [ 'Socket', 'Utils' ] ) )
+    SENFSCons.Objects( env, sources = sources, LIBS = [ 'Socket', 'Scheduler', 'Utils' ] ) )
 
 for sc in glob.glob("*/SConscript"):
     ob = SConscript(sc)
diff --git a/Socket/SConscript b/Socket/SConscript
index 31777820c..67b1bdc29 100644
--- a/Socket/SConscript
+++ b/Socket/SConscript
@@ -21,7 +21,7 @@ SENFSCons.Lib(env,
               library = 'Socket',
               sources = sources + subob,
               testSources = testSources,
-              LIBS = [ 'Utils' ])
+              LIBS = [ 'Scheduler', 'Utils' ])
 
 SENFSCons.Doxygen(env, extra_sources = [
     env.Dia2Png('SocketLibrary-classes.dia'),
-- 
GitLab