LIU Hao wrote:

> 在 2026-10-6 17:05, Kirill Makurin 写道:
>> While I don't oppose idea of mingw-64 providing C11 threading support, I 
>> think we should not provide them in the same way as other 
>> replacements/emulations - static functions in import libraries.
>>
>> My main concern is ABI stability. Each binary (EXE or DLL) will have their 
>> own statically linked implementation. If we ever change ABI or even an 
>> internal structure pointed to by handle-like objects, we will ultimately 
>> introduce breakages in cases such objects were passed across different 
>> binaries. Also, we might need to keep track of some internal state.
>>
>> If mingw-w64 were to implement C11 threading, I think it should be a 
>> separate library, so it can be used as a DLL.
>
> If it depends on winpthreads anyway then it may be implemented in there. The 
> separate DLL will be called
> libwinpthread-1.dll.

Implementing C11 threads support around winpthreads is surely an option. OTOH, 
C11 threads look pretty minimalistic:

1. Threads (thrd_t)
2. Mutexes (mtx_t)
3. Once (once_flag)
4. Conditional variables (cnd_t)

I think it would be better to implement them directly around Windows APIs, is a 
separate library. We could reuse code from winpthreads though.

Also, if we were to implement it in winpthreads, I guess we probably wound want 
to exclude it for MSVC builds, given that it provides its own C11 threads 
support now? It does feel right to me to provide different set of functions 
based on compiler used to build it, since built DLL can be used with any other 
compiler.

- Kirill Makurin

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to