Re: Re: Re: Adding a new thread model to GCC

2016-04-20 Thread lh_mouse
One more question about block-scoped static objects: >From compiled assembly I have learned that GCC uses a 64-bit integer guard to >ensure once-initialization of static objects with block scopes. Code in gcc/libstdc++-v3/libsupc++/guard.cc uses a global mutex to protect multiple threads from ra

Re: Re: Re: Adding a new thread model to GCC

2016-04-19 Thread lh_mouse
Thanks to ktietz, Elieux, mingwandroid (via IRC) and jwakely (via mail), the integration of mcfgthread and gcc has been accomplished. This 9000- patch applies to the gcc-5-branch after all other patches from https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-gcc-git are applied. Aft

Re: Re: Re: Adding a new thread model to GCC

2016-04-18 Thread lh_mouse
>>> If the current code assumes a struct and the Windows API calls need an >>> integer then either the existing code needs to be made more flexible, >>> or you need to define it as a struct and then convert to an integer >>> inside your new gthread wrapper functions. >> >> The Windows APIs involved

Re: Re: Re: Adding a new thread model to GCC

2016-04-18 Thread Jonathan Wakely
On 18 April 2016 at 10:57, Jonathan Wakely wrote: > On 18 April 2016 at 10:18, lh_mouse wrote: >>> I don't see why it has to be a struct, it just has to be suitable as >>> an argument to the relevant __gthread functions. >> >> The type __gthread_time_t is referenced in >> gcc/libstdc++-v3/include/

Re: Re: Re: Adding a new thread model to GCC

2016-04-18 Thread Jonathan Wakely
On 18 April 2016 at 10:18, lh_mouse wrote: >> I don't see why it has to be a struct, it just has to be suitable as >> an argument to the relevant __gthread functions. > > The type __gthread_time_t is referenced in > gcc/libstdc++-v3/include/std/mutex:157 > __gthread_time_t __ts = { >

Re: Re: Re: Adding a new thread model to GCC

2016-04-18 Thread lh_mouse
> I don't see why it has to be a struct, it just has to be suitable as > an argument to the relevant __gthread functions. The type __gthread_time_t is referenced in gcc/libstdc++-v3/include/std/mutex:157 __gthread_time_t __ts = { static_cast(__s.time_since_epoch().count()),

Re: Re: Re: Adding a new thread model to GCC

2016-04-18 Thread lh_mouse
- 发件人:Jonathan Wakely 发送日期:2016-04-18 16:59 收件人:lh_mouse 抄送:gcc,mingw-w64-public 主题:Re: Re: Adding a new thread model to GCC On 18 April 2016 at 08:39, lh_mouse wrote: > I have added a thread model and added its corresponding header files. But

Re: Re: Adding a new thread model to GCC

2016-04-18 Thread Jonathan Wakely
On 18 April 2016 at 08:39, lh_mouse wrote: > I have added a thread model and added its corresponding header files. But it > failed the linker. > > The file 'gcc/libgcc/config/i386/t-mingw-pthread' which contained two lines: > SHLIB_PTHREAD_CFLAG = -pthread > SHLIB_PTHREAD_LDFLAG = -Wl,-lpthrea

Re: Re: Adding a new thread model to GCC

2016-04-18 Thread Jonathan Wakely
On 17 April 2016 at 17:56, lh_mouse wrote: > A glance over gthr.h reminds me __gthread_time_t. There seem few requirements > documented in gthr.h. > I discussed this with Adrien Nader on mingw-w64's mailing list a few days ago. > > Specifically, here are the two questions: > 0) Should __gthread_t

Re: Re: Adding a new thread model to GCC

2016-04-18 Thread lh_mouse
I have added a thread model and added its corresponding header files. But it failed the linker. The file 'gcc/libgcc/config/i386/t-mingw-pthread' which contained two lines: SHLIB_PTHREAD_CFLAG = -pthread SHLIB_PTHREAD_LDFLAG = -Wl,-lpthread I copied the file to 'gcc/libgcc/config/i386/t-ming

Re: Re: Adding a new thread model to GCC

2016-04-17 Thread lh_mouse
A glance over gthr.h reminds me __gthread_time_t. There seem few requirements documented in gthr.h. I discussed this with Adrien Nader on mingw-w64's mailing list a few days ago. Specifically, here are the two questions: 0) Should __gthread_time_t be a struct or a plain integral type? The 'struct

Re: Re: Adding a new thread model to GCC

2016-04-14 Thread Torvald Riegel
On Thu, 2016-04-14 at 10:24 +0800, lh_mouse wrote: > Yes I learnt those *ByAddress* functions a few months ago and was shocked > that Microsoft had plagiarized futex from Linux. > As you have pointed out already, those APIs are only available on Windows 8 > and later. Yes. On Windows 8, given

Re: Re: Re: Adding a new thread model to GCC

2016-04-13 Thread lh_mouse
f it. -- Best regards, lh_mouse 2016-04-14 - 发件人:Dongsheng Song 发送日期:2016-04-14 11:02 收件人:lh_mouse 抄送:Torvald Riegel,gcc,mingw-w64-public 主题:Re: Re: Adding a new thread model to GCC Currently, --enable-threads=win32 map to

Re: Re: Adding a new thread model to GCC

2016-04-13 Thread Dongsheng Song
-------- > 发件人:Torvald Riegel > 发送日期:2016-04-14 01:40 > 收件人:lh_mouse > 抄送:gcc,mingw-w64-public > 主题:Re: Adding a new thread model to GCC > > On Wed, 2016-04-13 at 17:17 +0800, lh_mouse wrote: >> Hi all, >> >> The 'win32' thread

Re: Re: Adding a new thread model to GCC

2016-04-13 Thread lh_mouse
Riegel 发送日期:2016-04-14 01:40 收件人:lh_mouse 抄送:gcc,mingw-w64-public 主题:Re: Adding a new thread model to GCC On Wed, 2016-04-13 at 17:17 +0800, lh_mouse wrote: > Hi all, > > The 'win32' thread model of gcc has been there since long long ago, being > compatible with very old

Re: Adding a new thread model to GCC

2016-04-13 Thread Torvald Riegel
On Wed, 2016-04-13 at 17:17 +0800, lh_mouse wrote: > Hi all, > > The 'win32' thread model of gcc has been there since long long ago, being > compatible with very old Windows versions, also having a number of drawbacks: > 0) its implementation is very inefficient, and > 1) its mutexes and cond

Re: Re: Adding a new thread model to GCC

2016-04-13 Thread lh_mouse
btw this could be one or two days later. :<) -- Best regards, lh_mouse 2016-04-13 - 发件人:Jonathan Wakely 发送日期:2016-04-13 18:30 收件人:lh_mouse 抄送:gcc,mingw-w64-public 主题:Re: Adding a new

Re: Adding a new thread model to GCC

2016-04-13 Thread Jonathan Wakely
On 13 April 2016 at 10:17, lh_mouse wrote: > Hi all, > > The 'win32' thread model of gcc has been there since long long ago, being > compatible with very old Windows versions, also having a number of drawbacks: > 0) its implementation is very inefficient, and > 1) its mutexes and condition var