Commit 334f99fb authored by Pieter Hintjens's avatar Pieter Hintjens

Merge pull request #314 from ianbarber/master

Small patch to instantiate clock_t once
parents f663ad93 5b300895
......@@ -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);
......
......@@ -33,6 +33,7 @@
#include "i_poll_events.hpp"
#include "mailbox.hpp"
#include "stdint.hpp"
#include "clock.hpp"
#include "pipe.hpp"
namespace zmq
......@@ -194,6 +195,9 @@ namespace zmq
// True if the last message received had MORE flag set.
bool rcvmore;
// Improves efficiency of time measurement.
clock_t clock;
socket_base_t (const socket_base_t&);
const socket_base_t &operator = (const socket_base_t&);
mutex_t sync;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment