Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Sep 2000 11:59:09 -0700
From:      Alfred Perlstein <bright@wintelcom.net>
To:        smp@freebsd.org
Subject:   SMPng: catching signals and mutexes.
Message-ID:  <20000908115909.F12231@fw.wintelcom.net>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000908115909.F12231>