From c252bcb3f02d2faf54f8a241c60f36d97495bcbc Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Wed, 14 Nov 2012 01:35:27 +0100 Subject: [PATCH] bench: fix loop starvation bug Don't keep writing until the write queue fills up. On fast systems (mine), that never happens - the data is sent out as fast as the benchmark generates it. --- test/benchmark-pump.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/test/benchmark-pump.c b/test/benchmark-pump.c index 613b0abc..23944253 100644 --- a/test/benchmark-pump.c +++ b/test/benchmark-pump.c @@ -203,11 +203,9 @@ static void do_write(uv_stream_t* stream) { buf.base = (char*) &write_buffer; buf.len = sizeof write_buffer; - while (stream->write_queue_size == 0) { - req = (uv_write_t*) req_alloc(); - r = uv_write(req, stream, &buf, 1, write_cb); - ASSERT(r == 0); - } + req = (uv_write_t*) req_alloc(); + r = uv_write(req, stream, &buf, 1, write_cb); + ASSERT(r == 0); }