Hi, sorry for being so late.
I welcome a proper native thread implementation for windows gcc. I have one
point to address:
I like the fact that i can easily build static executables with mingw-w64.
In a few statements it was suggested that this will not be possible for
mcfgthread but i didn’t come across an explanation why.
Could you elaborate on that?

On Mon, Jun 20, 2016 at 3:55 PM lh mouse <[email protected]> wrote:

> > Is this set in stone, or is it foreseen to change it to a more liberal
> licence?
> The choice of that license was an ... accident. XD XD XD
> Since the library is expected to be linked dynamically it shouldn't matter
> much. If you consider it problematic, please let me know.
>
> > Another question is: is it still possible to use pthreads (via
> winpthreads)
> > if gcc is configured with --enable-threads=mcf?
> I don't think pthread_*() functions would break, but they will not work
> with threads created with thrd_create() or std::thread() which would not be
> created via pthread_create(), apparently.
> Certain construction of GCC and GCC libraries, for example, `__thread`,
> the C11 `_Thread_local`, the C++11 `thread_local` and the C++ exception
> handler, requires a gthread library to work (this is usually done with a
> header that redirects __gthread calls to other libraries such as winpthread
> or the gthr-win32 one in libgcc).
>
> > and finally: is it really necessary to rely on "undocumented NT system
> > calls for efficiency reasons"?
> All efforts have been made to make **little cost** mutexes and condition
> variables - they consume no system resources except the bytes where they
> reside in.
> It isn't necessary, only if we drop WIndows 7 support, because Microsoft
> has plagiarized the Linux futex APIs somehow:
> https://msdn.microsoft.com/en-us/library/windows/desktop/hh706898(v=vs.85).aspx
> (Note that these APIs are available only since Windows 8.)
> Windows 7 has the awesome SRW locks and condition variables, which, as
> usual, are over-specific for Microsoft people's own usage. Their SRW locks
> do not support timed waits and their condition variables do not support any
> mutexes other than SRW locks and critical sections.
> The keyed event APIs (http://locklessinc.com/articles/keyed_events/) are
> undocumented but turn out to be much powerful. If Microsoft people haven't
> implemented timed mutexes or generic condition variables, then it is we
> that should implement them.
>
> ------------------
> Best regards,
> lh_mouse
> 2016-06-20
>
> -------------------------------------------------------------
> 发件人:Carl Kleffner <[email protected]>
> 发送日期:2016-06-20 19:29
> 收件人:mingw-w64-public
> 抄送:
> 主题:Re: [Mingw-w64-public] Proposal for a C11 header and announcement
>  of mcfgthread,
>  a library that implements efficient C11 and C++11 thread support without
>  using winpthread
>
> Hi,
>
> most of the mcfgthread code is LGPL licenced (MCFLicense.txt
> <https://github.com/lhmouse/mcfgthread/blob/master/MCFLicense.txt>). Is
> this set in stone, or is it foreseen to change it to a more liberal
> licence?
>
> Another question is: is it still possible to use pthreads (via winpthreads)
> if gcc is configured with --enable-threads=mcf?
>
> and finally: is it really necessary to rely on "undocumented NT system
> calls for efficiency reasons"?
>
> Just a few points that come into my mind after a quick scan of your
> repository. The idea to overcome the schism of mingw-w64 thread
> configurations is really great.
>
> Regards
>
> Carl
>
>
> 2016-06-18 21:10 GMT+02:00 lh mouse <[email protected]>:
>
> > Hello everyone,
> >
> > It is with great honor that I bring you the C11-conforming header for
> > thread support of mcfgthread, c11thread.h:
> > https://github.com/lhmouse/mcfgthread/blob/master/src/env/c11thread.h
> > All headers in the mcfgthread project have been put into the public
> domain.
> >
> > As JonY suggested a few days ago, it would be nice for mingw-w64 to have
> > C11 thread support.
> > This announcement is not only a call for testers, but also a proposal for
> > a C11 header for mingw-w64. We can have both C11 and C++11 threads from
> > today.
> >
> > The following code illustrates how to use C11 threads:
> > ```
> > E:\Desktop>expand -t4 test.c
> > #include <mcfgthread/c11thread.h>
> > #include <stdio.h>
> > #include <stdlib.h>
> >
> > int thread_proc(void *param){
> >     printf("thread running: tid = %u, param = %p\n",
> > (unsigned)thrd_current(), param);
> >     for(int i = 0; i < 5; ++i){
> >         printf("thread going to sleep for one second...\n");
> >         struct timespec ts;
> >         ts.tv_sec = 1;
> >         ts.tv_nsec = 0;
> >         thrd_sleep(&ts, 0);
> >     }
> >     int exit_code = 67890;
> >     printf("thread exiting: exit_code = %d\n", exit_code);
> >     return exit_code;
> > }
> >
> > int main(){
> >     thrd_t tid;
> >     int err;
> >     if((err = thrd_create(&tid, &thread_proc, (void *)0x12345)) !=
> > thrd_success){
> >         printf("thrd_create() returned %d\n", err);
> >         abort();
> >     }
> >     printf("created thread: tid = %u\n", (unsigned)tid);
> >     int exit_code;
> >     if((err = thrd_join(tid, &exit_code)) != thrd_success){
> >         printf("thrd_join() returned %d\n", err);
> >         abort();
> >     }
> >     printf("joined thread: exit_code = %d\n", exit_code);
> > }
> >
> > E:\Desktop>gcc test.c -std=c11 -Wall -Wextra -pedantic -lmcfgthread
> >
> > E:\Desktop>a.exe
> > created thread: tid = 9876
> > thread running: tid = 9876, param = 00012345
> > thread going to sleep for one second...
> > thread going to sleep for one second...
> > thread going to sleep for one second...
> > thread going to sleep for one second...
> > thread going to sleep for one second...
> > thread exiting: exit_code = 67890
> > joined thread: exit_code = 67890
> >
> > E:\Desktop>
> > ```
> >
> > In order to use C++11 std::thread (as well as std::mutex,
> > std::condition_variable, etc) you must rebuild GCC and its libraries.
> > A few instructions can be found here:
> > https://github.com/lhmouse/mcfgthread/wiki
> >
> >
> > --------------
> > Best regards,
> > lh_mouse
> > 2016-06-19
> >
> >
> >
> >
> ------------------------------------------------------------------------------
> > What NetFlow Analyzer can do for you? Monitors network bandwidth and
> > traffic
> > patterns at an interface-level. Reveals which users, apps, and protocols
> > are
> > consuming the most bandwidth. Provides multi-vendor support for NetFlow,
> > J-Flow, sFlow and other flows. Make informed decisions using capacity
> > planning
> > reports. http://sdm.link/zohomanageengine
> > _______________________________________________
> > Mingw-w64-public mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
> >
>
> ------------------------------------------------------------------------------
> What NetFlow Analyzer can do for you? Monitors network bandwidth and
> traffic
> patterns at an interface-level. Reveals which users, apps, and protocols
> are
> consuming the most bandwidth. Provides multi-vendor support for NetFlow,
> J-Flow, sFlow and other flows. Make informed decisions using capacity
> planning
> reports. http://sdm.link/zohomanageengine
> _______________________________________________
> Mingw-w64-public mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
>
>
>
> ------------------------------------------------------------------------------
> What NetFlow Analyzer can do for you? Monitors network bandwidth and
> traffic
> patterns at an interface-level. Reveals which users, apps, and protocols
> are
> consuming the most bandwidth. Provides multi-vendor support for NetFlow,
> J-Flow, sFlow and other flows. Make informed decisions using capacity
> planning
> reports. http://sdm.link/zohomanageengine
> _______________________________________________
> Mingw-w64-public mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to