From owner-freebsd-current Thu Jan 21 22:11:50 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id WAA24968 for freebsd-current-outgoing; Thu, 21 Jan 1999 22:11:50 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from psf.Pinyon.ORG (ppp1-236.presc.dialup.futureone.com [209.250.11.236]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id WAA24959 for ; Thu, 21 Jan 1999 22:11:46 -0800 (PST) (envelope-from rcarter@psf.Pinyon.ORG) Received: from psf.Pinyon.ORG (localhost [127.0.0.1]) by psf.Pinyon.ORG (8.9.2/8.9.2) with ESMTP id TAA06788 for ; Thu, 21 Jan 1999 19:39:28 -0700 (MST) (envelope-from rcarter@psf.Pinyon.ORG) Message-Id: <199901220239.TAA06788@psf.Pinyon.ORG> X-Mailer: exmh version 2.0.2 2/24/98 To: freebsd-current@FreeBSD.ORG Subject: Re: Using LinuxThreads Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 21 Jan 1999 19:39:28 -0700 From: "Russell L. Carter" Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG dick@tar.com said: %For kernel threading you just use libc. Whether or not libc generates % thread safe (re-entrant) calls depends on whether its also linked %with a library that 1) sets __isthreaded to a non-zero value, 2) has a %_spinlock() implementationm, and 3) implements the functions %flockfile, funlockfile, etc. There are also a few macros in header %files that require _THREAD_SAFE to be defined to be thread safe. %libc_r could be modified so that is doesn't replace libc, but rather %is an addon, comparable to the kernel threaded libc case. But, it %would involve a bit of work. I thought so at first, but then I had to look at wait4 today and now I'm not so sure. At least some of libc_r is very closely tied to the uthread scheduler: uthread_wait4.c: #include #include #ifdef _THREAD_SAFE #include #include "pthread_private.h" pid_t wait4(pid_t pid, int *istat, int options, struct rusage * rusage) { pid_t ret; /* Perform a non-blocking wait4 syscall: */ while ((ret = _thread_sys_wait4(pid, istat, options | WNOHANG, rusage)) == 0 && (options & WNOHANG) == 0) { /* Reset the interrupted operation flag: */ _thread_run->interrupted = 0; /* Schedule the next thread while this one waits: */ _thread_kern_sched_state(PS_WAIT_WAIT, __FILE__, __LINE__); /* Check if this call was interrupted by a signal: */ if (_thread_run->interrupted) { errno = EINTR; ret = -1; break; } } return (ret); } #endif Russell To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message