diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2012-04-16 07:47:00 +0200 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2012-04-17 07:34:37 +0200 |
commit | dc4ed5a7b59f1d5b4e4f7fb4b6e29ecaf5e6cc5c (patch) | |
tree | 29987586f7012a31c187de491edc99aea174473b /src/surveyor.hpp | |
parent | 443d06f894751062da6d69238ce09f6fbfc27577 (diff) |
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 <sustrik@250bpm.com>
Diffstat (limited to 'src/surveyor.hpp')
-rw-r--r-- | src/surveyor.hpp | 8 |
1 files changed, 8 insertions, 0 deletions
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&); }; |