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

Aric Stewart aric at codeweavers.com
Thu Sep 3 07:14:13 CDT 2015



On 9/2/15 7:12 PM, Vincent Povirk wrote:
> 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.
> 
Yeah, I did not want to have to worry about holding a lock during processing, which mean basically i was copying the data out either on the RingBuffer_Read or locking, doing a read, then copying and unlocking anyway.

-aric



More information about the wine-devel mailing list