[PATCH] ntdll: Read the condition variable and manipulate the lock on the PE side.

Zebediah Figura z.figura12 at gmail.com
Fri Aug 21 10:09:54 CDT 2020


On 8/21/20 7:59 AM, Alexandre Julliard wrote:
> Zebediah Figura <z.figura12 at gmail.com> writes:
> 
>>      RtlLeaveCriticalSection( crit );
>> -    status = RtlWaitOnAddress( &variable->Ptr, &val, sizeof(int), timeout );
>> +    if ((status = unix_funcs->fast_wait_cv( variable, value, timeout )) == STATUS_NOT_IMPLEMENTED)
>> +        status = RtlWaitOnAddress( &variable->Ptr, &value, sizeof(value), timeout );
> 
> Couldn't you always use RtlWaitOnAddress, since it has a fast path
> already?  I'd like to reduce the number of non-syscall entry points into
> the Unix library.
> 

Unfortunately it's not as easy as that. Pseudo-futexes can't map onto
futexes directly, because they can have a size of 1/2/4/8 *and*
RtlWakeAddress* doesn't know the size. As a result we have to map them
onto a smaller, fixed-size array of futexes. That's worse performance
than we would like.

Implementing condition variables on top of that loses performance
relative to the current implementation, not only in theory but also in
practice—the game Path of Exile suffered from this (though I don't
remember how much).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20200821/81e801b9/attachment-0001.sig>


More information about the wine-devel mailing list