[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    Re: [3/3] hidclass.sys: Only return new reports when reading data from ringbuffer.
From:       Aric Stewart <aric () codeweavers ! com>
Date:       2016-10-27 18:55:18
Message-ID: c3e04122-2be4-6104-ce0d-eeb9ac9727d4 () codeweavers ! com
[Download RAW message or body]



On 10/27/16 9:45 AM, Sebastian Lackner wrote:
> Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
> ---
> 
> Depending on the buffer size, we might get a huge amount of old reports otherwise.
> 
> @ Aric: I believe there are some more things wrong with the ringbuffer \
> implementation. We shouldn't really need a ->start pointer, this is exactly what \
> the ring->pointers[] are used for. Also, the current implementation never uses all \
> slots. 

Reviews on the ringbuffer code is very welcome! Thanks!

It has been a while since I did that implementation but if I recall the purpose for \
start and end is about tracking the writing positions, It was more important before \
this patch, but after this patch you are correct that start is no longer needed. 2

-aric


> dlls/hidclass.sys/buffer.c |    2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/dlls/hidclass.sys/buffer.c b/dlls/hidclass.sys/buffer.c
> index 14e83e4..0b29f97 100644
> --- a/dlls/hidclass.sys/buffer.c
> +++ b/dlls/hidclass.sys/buffer.c
> @@ -170,7 +170,7 @@ UINT RingBuffer_AddPointer(struct ReportRingBuffer *ring)
> for( ;count < ring->pointer_alloc; count++)
> ring->pointers[count] = POINTER_UNUSED;
> }
> -    ring->pointers[idx] = ring->start;
> +    ring->pointers[idx] = ring->end;
> LeaveCriticalSection(&ring->lock);
> return idx;
> }
> 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic