4 ms·
what's the nt api call called? WaitForMultipleObjects? takes me back 20 years just thinking about it...
by a-dub 6y ago
what's the nt api call called? WaitForMultipleObjects? takes me back 20 years just thinking about it...
- Joker_vD 6y agoBy the way, hearing about futex implementation and their API considerations should also bring everyone about 20 years back.
- dboreham 6y agoThe NT api would begin ntXxxx WaitForMultipleObjects is a Win32 function.
- poizan42 6y agoI don't know why you are being downvoted, you are completely right. The NT api function is NtWaitForMultipleObjects. The Win32 apis WaitForMultipleObjects and WaitForMultipleObjectsEx are thin wrappers over this.
- AndriyKunitsyn 6y agoIs this NT API actually possible to be called from userspace? Or even from drivers?
- poizan42 6y agoYes of course, they are all exported from ntdll.dll (in userspace) and ntoskrnl.exe (in kernelspace). You may need to link dynamically or make your own import libraries for many of them though.
- andrealmeid 6y agoSure, here's an userspace example: https://docs.microsoft.com/en-us/windows/win32/sync/waiting-for-multiple-objects https://docs.microsoft.com/en-us/windows/win32/sync/waiting-...
- a-dub 6y agothink of it as like select and pthread_cond_wait rolled into one generic api for waiting on one or more things from the kernel. it's actually pretty nice how generic they made it.
- leeter 6y agoBased on the docs kernel mode drivers would call KeWaitForMultipleObjects instead it appears. User space should just call WaitForMultipleObjects. While NtWaitForMultipleObjects and ZwWaitForMultipleObjects exist they seem to be undocumented which means they probably have funky behavior. Anything in KernelBase.dll is a pretty thin wrapper that I'd be hesitant to call Win32 so much as "really thin syscall wrapper"
- ziml77 6y agoIf we're being pedantic here, it's not Win32. > (Note that this was formerly called the Win32 API. The name Windows API more accurately reflects its roots in 16-bit Windows and its support on 64-bit Windows.) Though Win32 is going to stick around for a while as can be seen in the URL for the page that's quoted from: https://docs.microsoft.com/en-us/windows/win32/apiindex/windows-api-list https://docs.microsoft.com/en-us/windows/win32/apiindex/wind...
- a-dub 6y agoi think it's still called win32 today because win32 was a massive overhaul. 16 bit windows was loaded with that far and near pointer gunk to stretch those 16 bit pointers which win32 was able to do away with thanks to larger pointer widths. regarding win32 vs. the nt api. i'm not super familiar with the pedantic distinctions there, but i do know, much to the programmer's chagrin, the thousands of windows api functions have varying levels of kernel entry, where i always have appreciated the (relatively) small number of unix style syscalls and the clear delineation between kernel and userspace api. (although i suppose futexes blur that, in name at least!)
- Joker_vD 6y agoWell, since introduction of vsyscall and vDSO, the Linux syscalls too have varying levels of kernel entry.
- beatrobot 6y agoNtXxxx or ZwXxxx
- tobias3 6y agoWaitOnAddress and co. But that one was added with Windows 8, so it can't take you back 20 years :)
- gpderetta 6y agoWFMO is indeed the api that the new futex_waitv is supposed to help accelerate under wine.