[M3devel] 5.8.6 LINUXLIBC6 breakage, kernel 2.6.23, glibc-2.6-4

Coleburn, Randy rcolebur at SCIRES.COM
Mon Apr 18 23:35:40 CEST 2011


I think it would be good at this point to clarify for folks on the m3devel list what is meant by the various terms:
-pthreads
-user threads
-Win32 native threads
-green threads
-etc.

I think I know what all these mean, except for "green" threads, but I'm not quite sure anymore.

Also, in the current CM3 HEAD implementation, are we still using Windows native threads on WIN32 platforms?

I too am observing problems with threading on Windows not behaving well.  This situation concerns me because thread safety is something I've always relied on Modula-3 to provide.

I think we need to post how the various threading models map to the various implementation platforms, and what options one needs to use to select between the models, and on which platforms a choice of threading model is available.

Regards,
Randy Coleburn

-----Original Message-----
From: Mika Nystrom [mailto:mika at async.caltech.edu] 
Sent: Monday, April 18, 2011 2:46 PM
To: Tony Hosking
Cc: m3devel at elegosoft.com
Subject: Re: [M3devel] 5.8.6 LINUXLIBC6 breakage, kernel 2.6.23, glibc-2.6-4

Tony Hosking writes:
...
>pthread_atfork should not be needed under user threads.
...

The following code from RTProcessC.c ensures that it is neeeded on every Unix except
FreeBSD before 6.  The comment is from the checked-in source file.

/* NOTE: Even userthreads now depends
 * on availability of pthreads.
 * This can be fixed if need be.
 */

INTEGER
__cdecl
RTProcess__RegisterForkHandlers(
    ForkHandler prepare,
    ForkHandler parent,
    ForkHandler child)
{
/* FreeBSD < 6 lacks pthread_atfork. Would be good to use autoconf.
 * VMS lacks pthread_atfork? Would be good to use autoconf.
 * Win32 lacks pthread_atfork and fork. OK.
 *
 * As well, for all Posix systems, we could implement
 * atfork ourselves, as long as we provide a fork()
 * wrapper that code uses.
 */
#if defined(_WIN32) \
        || defined(__vms) \
        || (defined(__FreeBSD__) /* && (__FreeBSD__ < 6)*/ )
    return 0;
#else
    while (1)
    {
      int i = pthread_atfork(prepare, parent, child);
      if (i != EAGAIN)
        return i;
      sleep(0);
    }
#endif
}




More information about the M3devel mailing list