[Bro-Dev] [Bro-Commits] [git/bro] master: Fix for input readers occasionally dead-locking. (c980d10)

Gilbert Clark gc355804 at ohio.edu
Fri Oct 25 14:55:52 PDT 2013


I meant compare the absolute counters (_ctr), not the pointers (_ptr).  
Assuming I understand how this works, read_ctr / write_ctr are absolute 
counts kept in order to keep track of how many times the queue has been 
read from / written to, are incremented in the same places that the 
pointers are, and are currently only used to keep statistics for the 
queue.  Since these counts are absolute, there shouldn't be a situation 
where they're equal unless the queue is empty.

Also, keeping both the counters and the pointers around may be 
redundant.  I think it'd be a pretty easy change to start using absolute 
values only and mod on access, and I'd imagine performance-wise it would 
end up being pretty comparable.

Cheers,
Gilbert

On 10/25/13 2:24 PM, Robin Sommer wrote:
> On Fri, Oct 25, 2013 at 00:04 -0400, you wrote:
>
>>   * Since we know that read_ctr is only incremented after a successful
>>   read, and write_ctr is only incremented after a successful write, the
>>   two values should be equal iff the queue is empty.
> That's actually not the case, and that was the problem. There can be
> elements in the queue even if both pointers align; that happens if the
> writer is exactly a full round ahead of the reader.
>
> Robin
>



More information about the bro-dev mailing list