Skip site navigation (1)Skip section navigation (2)
Date:      Mon,  3 Feb 97 15:53:25 +0000
From:      Andrew.Gordon@net-tel.co.uk
To:        rminnich@Sarnoff.COM
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: OK, here goes fastlock: (fwd)
Message-ID:  <"3a14-970203154823-6178*/G=Andrew/S=Gordon/O=NET-TEL Computer Systems Ltd/PRMD=NET-TEL/ADMD=Gold 400/C=GB/"@MHS>
In-Reply-To: <Pine.SUN.3.91.970203093001.3325G-100000@terra>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
[debug ifdefs removed from quoted section for brevity]
> fastunlock(int *address, int unlockval)
> {
>   int dosyscall = 0;
>   static int syscallnum = -1; /* this is really in the file */
>   if (*address & 0x80000000)  /***/
>     dosyscall = 1;
>   *address = unlockval;
>   if (dosyscall)
>     syscall(syscallnum, 0, address, unlockval);
> }

Isn't there a race here?  If the process holding the lock happens to
get descheduled at the point marked /***/ and another process blocks
waiting for the lock, the syscall doesn't get called and the second
process continues to block until the 10 second timeout in the syscall.

This can no doubt be fixed with another tset of some sort when releasing
the lock.

> 2) The 'address' argument does NOT NEED TO BE AN ADDRESS. it's a number
>    that all the procs have to agree on, that is all.

You seem to be assuming that it _is_ an address in this implementation
however:

>                         int curval = fuword((void *) uap->address);
>                         if (curval == uap->unlocked)
>                                 return;



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?"3a14-970203154823-6178*/G=Andrew/S=Gordon/O=NET-TEL Computer Systems Ltd/PRMD=NET-TEL/ADMD=Gold 400/C=GB/">