On 8/21/20 7:59 AM, Alexandre Julliard wrote:
Zebediah Figura z.figura12@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).