port of patch by Martin Sustrik to libxs: This patch instantiate a clock_t instance for each XS

socket. Thus, it is shared between subsequent calls
to xs_recv (and xs_send). That in turn significantly
limits the number of invocations of  getimeofday (or similar)
when timeouts are used and recv/send is called in a
tight loop.
This commit is contained in:
Ian Barber
2012-04-17 10:10:22 +01:00
parent f663ad935b
commit 5b3008957d
2 changed files with 4 additions and 3 deletions

View File

@@ -46,7 +46,6 @@
#include "io_thread.hpp"
#include "session_base.hpp"
#include "config.hpp"
#include "clock.hpp"
#include "pipe.hpp"
#include "err.hpp"
#include "ctx.hpp"
@@ -560,7 +559,6 @@ int zmq::socket_base_t::send (msg_t *msg_, int flags_)
// Compute the time when the timeout should occur.
// If the timeout is infite, don't care.
clock_t clock ;
int timeout = options.sndtimeo;
uint64_t end = timeout < 0 ? 0 : (clock.now_ms () + timeout);
@@ -643,7 +641,6 @@ int zmq::socket_base_t::recv (msg_t *msg_, int flags_)
// Compute the time when the timeout should occur.
// If the timeout is infite, don't care.
clock_t clock ;
int timeout = options.rcvtimeo;
uint64_t end = timeout < 0 ? 0 : (clock.now_ms () + timeout);