[ovs-dev] [threads v2 08/13] byteq: Make the queue size variable instead of fixed at BYTEQ_SIZE bytes.

Ben Pfaff blp at nicira.com
Wed Jul 17 18:45:08 UTC 2013


On Wed, Jul 17, 2013 at 11:26:06AM -0700, Alex Wang wrote:
> Just one question, for the code below in "lib/byteq.c"
> 
> """
> /* Returns the number of bytes current queued in 'q'. */
> int
> byteq_used(const struct byteq *q)
> {
>     return q->head - q->tail;
> }
> """
> 
> Is it possible that the jsonrpc session last so long that the 'q->head'
> gets overflowed? or the chance is so slim that we do not care,

It can overflow but it doesn't matter, arithmetic modulo 2**N will
always do the right thing anyway.



More information about the dev mailing list