From dc4ed5a7b59f1d5b4e4f7fb4b6e29ecaf5e6cc5c Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Mon, 16 Apr 2012 07:47:00 +0200 Subject: XS_SURVEY_TIMEOUT socket option added. It can be used to timeout the survey. Value is in milliseconds and -1 means infinite (default). Signed-off-by: Martin Sustrik --- src/surveyor.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/surveyor.hpp') diff --git a/src/surveyor.hpp b/src/surveyor.hpp index 83fdbb0..a77af49 100644 --- a/src/surveyor.hpp +++ b/src/surveyor.hpp @@ -23,6 +23,7 @@ #include "xsurveyor.hpp" #include "stdint.hpp" +#include "clock.hpp" namespace xs { @@ -44,6 +45,7 @@ namespace xs int xrecv (xs::msg_t *msg_, int flags_); bool xhas_in (); bool xhas_out (); + int rcvtimeo (); private: @@ -53,6 +55,12 @@ namespace xs // The ID of the ongoing survey. uint32_t survey_id; + // The time instant when the current survey expires. + uint64_t timeout; + + // Provides a way to measure time quickly. + clock_t clock; + surveyor_t (const surveyor_t&); const surveyor_t &operator = (const surveyor_t&); }; -- cgit v1.2.3