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

@@ -63,7 +63,8 @@ zmq::pipe_t::pipe_t (object_t *parent_, upipe_t *inpipe_, upipe_t *outpipe_,
peer (NULL),
sink (NULL),
state (active),
delay (delay_)
delay (delay_),
pipe_id (0)
{
}
@@ -85,6 +86,16 @@ void zmq::pipe_t::set_event_sink (i_pipe_events *sink_)
sink = sink_;
}
void zmq::pipe_t::set_pipe_id (uint32_t id_)
{
pipe_id = id_;
}
uint32_t zmq::pipe_t::get_pipe_id ()
{
return pipe_id;
}
bool zmq::pipe_t::check_read ()
{
if (unlikely (!in_active || (state != active && state != pending)))