From owner-freebsd-current Sat Oct 31 14:30:27 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id OAA25402 for freebsd-current-outgoing; Sat, 31 Oct 1998 14:30:27 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from ns.tar.com (ns.tar.com [204.95.187.2]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id OAA25395 for ; Sat, 31 Oct 1998 14:30:25 -0800 (PST) (envelope-from lists@tar.com) Received: from ppro.tar.com (ppro.tar.com [204.95.187.9]) by ns.tar.com (8.9.1/8.8.7) with SMTP id QAA24045; Sat, 31 Oct 1998 16:30:14 -0600 (CST) Message-Id: <199810312230.QAA24045@ns.tar.com> From: "Richard Seaman, Jr." To: "John Birrell" Cc: "current@freebsd.org" Date: Sat, 31 Oct 98 16:30:13 -0600 Reply-To: "Richard Seaman, Jr." X-Mailer: PMMail 1.92 For OS/2 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Subject: Re: Kernel threading (was Re: Thread Scheduler bug) Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sun, 1 Nov 1998 08:47:34 +1100 (EST), John Birrell wrote: >If you wrapper the syscalls, you get compatibility problems. If the >syscalls block in the kernel, then that's where thay should be cancelled. Well, I don't know nearly as much about this as you do, so please bear with me. The syscall wrapper I am talking about looks like this (for the syscalls that are defined as canellation points): pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); _thread_sys_xxx (..........) pthread_setcanceltype (oldtype, NULL); Then, if another thread does a pthread_cancel on the thread that's in the syscall, and if the cancel state of the thread is CANCEL_ENABLE, it sends it a signal SIGCANCEL. SIGCANCEL will have to be defined (Linux uses SIGUSR2, if I'm not mistaken). You have to have a signal handler setup too, obviously, which does a pthread_exit (in the case of ASYNCHRONOUS cancellation). If the syscall can be interrupted by the signal, you'll break out of the wait and exit. If not, you'll exit when the second pthread_setcanceltype function is called. What am I missing? >Is that the user LDT implementation? I don't know. Its whatever code was posted in John Dyson's message of August 20, 1998, to the -hackers list, titled "rfork stuff". I have a copy if you need one. I'm just copying some of his code blindly, with only partial (or no) comprehension. If there's something fundamentally wrong with it, it would be helpful if you noted it so I don't waste my time. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message