O(1) fair-queueing in XREP implemented

Up to now the complexity of fair-queueing in XREP was O(n).

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
This commit is contained in:
Martin Sustrik
2011-06-22 16:51:40 +02:00
parent ec81f8fb25
commit 12532c7940
4 changed files with 50 additions and 105 deletions

View File

@@ -25,6 +25,7 @@
#include "ypipe.hpp"
#include "config.hpp"
#include "object.hpp"
#include "stdint.hpp"
#include "array.hpp"
namespace zmq
@@ -67,6 +68,10 @@ namespace zmq
// Specifies the object to send events to.
void set_event_sink (i_pipe_events *sink_);
// Pipe endpoint can store an opaque ID to be used by its clients.
void set_pipe_id (uint32_t id_);
uint32_t get_pipe_id ();
// Returns true if there is at least one message to read in the pipe.
bool check_read ();
@@ -176,6 +181,9 @@ namespace zmq
// asks us to.
bool delay;
// Opaque ID. To be used by the clients, not the pipe itself.
uint32_t pipe_id;
// Returns true if the message is delimiter; false otherwise.
static bool is_delimiter (msg_t &msg_);