[7/13](resend)hidclass.sys: Implement IRP_MJ_READ for HID Devices

Vincent Povirk madewokherd at gmail.com
Wed Sep 2 19:12:56 CDT 2015


On Wed, Sep 2, 2015 at 3:34 PM, Andrew Eikum <aeikum at codeweavers.com> wrote:
> Is it necessary to make a copy of the data in the ring buffer? Seems
> like returning a raw pointer would be more efficient. I flipped
> through the rest of the patch sequence and all uses of RingBuffer_Read
> seemed to be read-only.

We have to hold the critical section while reading the data to prevent
another thread from writing to it (RingBuffer_Write added in next
patch).

This doesn't mean we have to copy it, but the alternative is to
require readers to "lock" when reading and "unlock" when finished with
the data. And I don't know if it's a good idea to call
IoCompleteRequest while holding a mutex.



More information about the wine-devel mailing list