Count concurrent calls blocking on a full WHC

The writer tracks whether it is throttled because of a full WHC, but
does so by treating it as a simple flag.  This is fine if there is at
most one thread blocked on any single writer at any time, but if there
are multiple threads using the same writer it would be possible for one
thread to be woken up, clear the flag, and so affect the wakeup of other
threads.

Turning it from a flag to a counter avoids that problem.

Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
Erik Boasson 2019-03-15 14:57:04 +01:00
parent f997972ec7
commit 9743bda57b

View file

@ -960,7 +960,7 @@ static os_result throttle_writer (struct nn_xpack *xp, struct writer *wr)
}
DDS_LOG(DDS_LC_THROTTLE, "writer %x:%x:%x:%x waiting for whc to shrink below low-water mark (whc %"PRIuSIZE" low=%u high=%u)\n", PGUID (wr->e.guid), whcst.unacked_bytes, wr->whc_low, wr->whc_high);
wr->throttling = 1;
wr->throttling++;
wr->throttle_count++;
/* Force any outstanding packet out: there will be a heartbeat
@ -1000,7 +1000,7 @@ static os_result throttle_writer (struct nn_xpack *xp, struct writer *wr)
}
}
wr->throttling = 0;
wr->throttling--;
if (wr->state != WRST_OPERATIONAL)
{
/* gc_delete_writer may be waiting */