why does gccgit require pthread?

LIU Hao lh_mouse@126.com
Mon Nov 7 07:10:36 GMT 2022


在 2022/11/7 15:03, Andrew Pinski 写道:
>>
>> The win32 thread model does not have `std::mutex`; but there is no `pthread_mutex_t` either, so it
>> does not build either way.
> Oh, but I would assume it will later on right?
> 

There has been effort on C++11 threading support for win32 thread model, but I have a negative 
attitude on that.

Another solution is to use `__gthread_mutex_t` instead of `pthread_mutex_t`, which is also available 
in the win32 thread model. Actually I prefer this approach as it keeps code structure like what we 
have at this moment.


> Also I think you might need to change some more than you did.
> That is:
> -#define INCLUDE_PTHREAD_H
>   #include "system.h"
> 
> You must likely have a macro, INCLUDE_MUTEX, and define that and
> include mutex in system.h like it was done for pthread.h.
> GCC loves to poison identifiers while lexing to make sure those
> identifiers are not used inside GCC and the include of mutex should be
> done early.
> 

Well I am not familiar with such behavior. Feel free to amend the patch, until it looks good to you. 
I hope we can check this in before GCC 13 RC.



-- 
Best regards,
LIU Hao

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20221107/a7240dfd/attachment-0001.sig>


More information about the Gcc mailing list