Windows NT synchronization primitives for Linux
Windows NT synchronization primitives for Linux
Posted Feb 22, 2024 6:54 UTC (Thu) by calumapplepie (guest, #143655)In reply to: Windows NT synchronization primitives for Linux by farnz
Parent article: Windows NT synchronization primitives for Linux
Grep through the binary of whatever wine is executing for wait_for_all calls, then disable the optimization if any are spotted?
Posted Feb 22, 2024 7:41 UTC (Thu)
by Wol (subscriber, #4433)
[Link] (5 responses)
Cheers,
Posted Feb 22, 2024 9:52 UTC (Thu)
by farnz (subscriber, #17727)
[Link] (4 responses)
You can't do it on the first call, because to implement it properly, you need to prevent previous wait-for-any calls from using the kernel mechanism; time-travelling backwards like that is a technical challenge. And Windows handles it by having its kernel equivalent of /dev/ntsync handle wait-for-all as well as wait-for-any; it may have fast paths in there for wait-for-any, but it's all in-kernel.
Posted Feb 22, 2024 15:05 UTC (Thu)
by Wol (subscriber, #4433)
[Link] (3 responses)
Otherwise you could presumably ref-count wait-for-any, and if the count was non-zero you'd have to divert new calls and wait for existing calls to go to zero. Messy, assuming it's even possible ...
Cheers,
Posted Feb 22, 2024 15:21 UTC (Thu)
by farnz (subscriber, #17727)
[Link] (2 responses)
You also need some mechanism to tell all the existing calls in the kernel that wineserver is taking over wait calls now, so they need to return to userspace and be retried (inside Wine) by the IPC mechanism instead of the kernel mechanism, otherwise you can't correctly implement the corner-cases of Win32 when you have both wait-for-any and wait-for-all referencing the same objects.
Posted Feb 22, 2024 17:04 UTC (Thu)
by Wol (subscriber, #4433)
[Link] (1 responses)
Cheers,
Posted Feb 22, 2024 21:36 UTC (Thu)
by farnz (subscriber, #17727)
[Link]
Wine needs to take over before the ref count drops to zero, else you've regressed. To match Windows kernel behaviour, you either need the Linux kernel to support wait-for-all somehow, or you need the Linux kernel to hand over the existing wait-for-any waits to Wine, so that Wine can correctly emulate the corner cases of wait-for-all.
Windows NT synchronization primitives for Linux
Wol
Windows NT synchronization primitives for Linux
Windows NT synchronization primitives for Linux
Wol
Windows NT synchronization primitives for Linux
Windows NT synchronization primitives for Linux
Wol
Windows NT synchronization primitives for Linux