From owner-freebsd-smp Fri Sep 8 11:59:13 2000 Delivered-To: freebsd-smp@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id 4D21137B446 for ; Fri, 8 Sep 2000 11:59:10 -0700 (PDT) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id e88IxAL10017 for smp@freebsd.org; Fri, 8 Sep 2000 11:59:10 -0700 (PDT) Date: Fri, 8 Sep 2000 11:59:09 -0700 From: Alfred Perlstein To: smp@freebsd.org Subject: SMPng: catching signals and mutexes. Message-ID: <20000908115909.F12231@fw.wintelcom.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.4i Sender: owner-freebsd-smp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org There seems to be no way to specify that a signal is to interrupt a wait on a mutex, I'm wondering if we should make it possible to do so. code in question: sb_lock() uipc_socket2.c line 313 of 1012: while (sb->sb_flags & SB_LOCK) { sb->sb_flags |= SB_WANT; error = tsleep((caddr_t)&sb->sb_flags, (sb->sb_flags & SB_NOINTR) ? PSOCK : PSOCK|PCATCH, "sblock", 0); if (error) return (error); } sb->sb_flags |= SB_LOCK; return (0); has to made into: int sb_lock(sb) register struct sockbuf *sb; { int error; while (mtx_try_enter(sb->sb_mtx, MTX_DEF) == 0) { error = tsleep((caddr_t)&sb->sb_flags, (sb->sb_flags & SB_NOINTR) ? PSOCK : PSOCK|PCATCH, "sblock", 0); if (error) return (error); } return (0); } I'm not sure I like this at all, shouldn't there be an mtx_enter with some option to return an error if a signal arrives? Thanks, -- -Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org] "I have the heart of a child; I keep it in a jar on my desk." To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-smp" in the body of the message