0
0
mirror of https://github.com/zeromq/libzmq.git synced 2025-01-01 10:50:28 +08:00

Merge pull request #314 from ianbarber/master

Small patch to instantiate clock_t once
This commit is contained in:
Pieter Hintjens 2012-04-17 03:49:43 -07:00
commit 334f99fb01
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);

View File

@ -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;