aboutsummaryrefslogtreecommitdiff
path: root/libbutl/fdstream.ixx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-10-16 22:18:45 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-11-06 10:47:57 +0300
commitae43c5780651d594b1ec76e99330cd6ef082b0c5 (patch)
tree76a18276dbec9e63eb9dd8d09cbd5786a21610c6 /libbutl/fdstream.ixx
parent3ee9761b73aff34c7f30ee44b8aac276d413cc21 (diff)
Add fdselect() overload that also takes timeout
Diffstat (limited to 'libbutl/fdstream.ixx')
-rw-r--r--libbutl/fdstream.ixx19
1 files changed, 19 insertions, 0 deletions
diff --git a/libbutl/fdstream.ixx b/libbutl/fdstream.ixx
index fb57b99..4ef5b1d 100644
--- a/libbutl/fdstream.ixx
+++ b/libbutl/fdstream.ixx
@@ -353,4 +353,23 @@ namespace butl
{
return fdmode (stderr_fd (), m);
}
+
+ // fdselect
+ //
+ // Implement fdselect() function templates in terms of their milliseconds
+ // specialization.
+ //
+ template <>
+ LIBBUTL_SYMEXPORT std::pair<std::size_t, std::size_t>
+ fdselect (fdselect_set&, fdselect_set&, const std::chrono::milliseconds&);
+
+ template <typename R, typename P>
+ inline std::pair<std::size_t, std::size_t>
+ fdselect (fdselect_set& ifds,
+ fdselect_set& ofds,
+ const std::chrono::duration<R, P>& timeout)
+ {
+ using namespace std::chrono;
+ return fdselect (ifds, ofds, duration_cast<milliseconds> (timeout));
+ }
}