Repository navigation
[win] Don't build a custom nanosleep() when not needed - #1256
Conversation
|
There is still an unorthodox usage of Though I'm not sure if such a change is acceptable or not |
It used to exist even if not in a standard. Google search on it first hit leads me to; Since it is unorthodox it is OK to change it IMO. |
|
I approve the change but wait to see what you do about |
|
Hi, @ddennedy! I did a small test here and it seems like it is not easy to add So, we have three options here:
|
|
|
| if(MINGW) | ||
| string(REPLACE "iconv" "pthread" MLT_PTHREAD_LIBS "${Iconv_LIBRARY}") |
There was a problem hiding this comment.
This was added for a reason not too long ago. See git blame. Explain why it is no longer needed.
There was a problem hiding this comment.
Github lost my long comment that I was writing, so I will be short :(
The commit introducing that is: 64aa543
It has no explanation why it is needed, and what issue it is supposed to fix. Every target having this variable does already link to Threads::Threads so the hack looks unnecessary.
|
Please address the comments. |
|
Hi, @ddennedy! I plan to return to this patch some time soon, I was just busy with other things (and then the vacation came :) ) |
e2460b7 to
07c247a
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Two public-header regressions break installed Windows header lookup and the fallback nanosleep() type declaration for C consumers.
2 open issues
What changed in this PR
This PR replaces MLT’s include-order-dependent Windows nanosleep() workaround with a CMake capability check against the pthread library.
Changes:
- Detects pthread-provided
nanosleep()and generates an installed configuration header. - Uses the detected capability to guard compatibility declarations and implementation.
- Removes inferred pthread library paths and updates thread and SDL2 target linking.
| File | Description |
|---|---|
src/win32/win32.c |
Guards fallback nanosleep() using the detected capability. |
src/modules/sdl2/CMakeLists.txt |
Removes explicit inferred pthread linking. |
src/modules/avformat/CMakeLists.txt |
Removes explicit inferred pthread linking. |
src/melt/CMakeLists.txt |
Updates MinGW thread and SDL2 target linking. |
src/framework/mlt_types.h |
Uses configuration-based guards for Windows declarations. |
src/framework/mlt_config.h.in |
Adds the pthread nanosleep() capability macro template. |
src/framework/CMakeLists.txt |
Checks availability and generates and installs the configuration header. |
CMakeLists.txt |
Removes pthread library path inference from the iconv path. |
Review effort: Balanced
Instead of relying of the includes order we should properly check if the function is actually provided by our version of pthread library.
07c247a to
15b2a98
Compare
|
Hi, @ddennedy! I've scraped the previous approach and implemented a full version with |
|
I will also check consumption of this package on Windows now... I've check the building only |
Yes, consumption in Krita with on Windows works fine (llvm-mingw toolchain). |

Instead of relying of the includes order we should properly
check if the function is actually provided by our version
of pthread library.
The patch basically reverts an original hack to resolve the
issue in msys2 and implements a proper detection mechanism
for the presence of nanosleep() in the pthread library