Adding a new thread model to GCC
i.nixman@autistici.org
i.nixman@autistici.org
Fri Oct 21 10:09:55 GMT 2022
On 2022-10-21 09:58, Jonathan Wakely via Libstdc++ wrote:
> How does this compare with Eric B's proposal at
> https://gcc.gnu.org/legacy-ml/gcc-patches/2019-06/msg01840.html ?
>
> It would be good if we can accept one of them for GCC 13, but I don't
> know Windows well enough to determine which is better.
I had the same question...
I would like to understand what is the difference?
Moreover I would like to understand what is the difference with the
already added support for the winpthreads library?
@LIU Hao, could you explain please?
best!
> On Sat, 1 Oct 2022 at 19:35, LIU Hao via Libstdc++
> <libstdc++@gcc.gnu.org> wrote:
>>
>> Greetings.
>>
>> After some years I think it's time to put on this topic again.
>>
>> This patch series is an attempt to add a new thread model basing on
>> the mcfgthread library
>> (https://github.com/lhmouse/mcfgthread), which provides efficient
>> implementations of mutexes,
>> condition variables, once flags, etc. for native Windows.
>>
>>
>> The first patch is necessary because somewhere in libgfortran,
>> `pthread_t` is referenced. If the
>> thread model is not `posix`, it fails to compile.
>>
>> The second patch implements `std::thread::hardware_concurrency()` for
>> non-posix thread models. This
>> would also work for the win32 thread model if `std::thread` would be
>> supported in the future.
>>
>> The third patch adds the `mcf` thread model for GCC and its libraries.
>> A new builtin macro
>> `__USING_MCFGTHREAD__` is added to indicate whether this new thread
>> model is in effect. This grants
>> `std::mutex` and `std::once_flag` trivial destructors;
>> `std::condition_variable` is a bit
>> unfortunate because its destructor is non-trivial, but in reality no
>> cleanup is performed.
>>
>>
>> I have been bootstrapping GCC with the MCF thread model for more than
>> five years. At the moment, C,
>> C++ and Fortran are supported. Ada is untested because I don't know
>> how to bootstrap it. Objective-C
>> is not supported, because threading APIs for libobjc have not been
>> implemented.
>>
>> Please review. If there are any changes that I have to make, let me
>> know.
>>
>>
>> --
>> Best regards,
>> LIU Hao
More information about the Libstdc++
mailing list