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

Mika Nystrom mika at async.caltech.edu
Mon Apr 18 20:45:40 CEST 2011


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