The cast works best if you don't imply another conversion to a
temporary. Just return the value directly from the syscall/pthreads
call, while casting to a DWORD.
macOS uses a 64-bit thread ID, so rather than truncate this in
GetCurrentThreadId, use pthread_self's result and mix it with the MSBs
of the pointer to reduce the probability of a collision.
Truncating 64-bit thread IDs to 32-bits can result in collisions on
systems with large numbers of CPUs. GetCurrentThreadId() does this, and
there are fairly easy to reproduce collisions on systems with ~128 CPU
cores.
The `GetCurrentThreadId` API should wrap an OS-specific way of providing
the current thread ID. Keep the XOR-folded pointer as a fallback for
OSes which aren't explicitly supported.
This fixes failures in TestSynchCritical that are readily reproducible
on such systems..
Tested on FreeBSD 14.3 and various Linux variants on x86_64.
* Keep BUILD_TESTING, but only run tests compatible with API (for
packaging)
* Add BUILD_TESTING_INTERNAL for all tests including internal function
tests that modify API to be run on our CI
* Disable clang-tidy in test build directories
* Disable compiler warnings for test binary directories.
These contain generated code we can not change, so the warnings are just noise
* Fix build with mingw
4a71cab2e7 broke wf_events.c.
The drive channel was not building because of missing definitions.
* winpr: make functions return False when not implemented
This patch improves waiting on process handles:
* under linux we take advantage of pidfd if available, when it can be used it
allows to have one or more process in the objects that are WaitForMultipleObject-ed.
* the patch also make the code honor the timeout parameter during a WaitForSingleObject and
possibly run completion when WaitForSingleObjectEx is executed with alertable set to true
This patch adds some checks for the type of object in Event and Thread functions,
this may help to find bugs where a handle with the wrong type is used as argument
of these functions.