Date: Thu, 30 Dec 2004 02:43:32 -0500 (EST) From: Jeff Roberson <jroberson@chesapeake.net> To: David Xu <davidxu@FreeBSD.org> Cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/sys umtx.h src/sys/kern kern_umtx.c Message-ID: <20041230024007.B60504@mail.chesapeake.net> In-Reply-To: <200412300256.iBU2uHuN071595@repoman.freebsd.org> References: <200412300256.iBU2uHuN071595@repoman.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
I'm not sure I understand how you can protect against all races without the kernel's casuptr(). What happens if thread a owns a lock, and thread b fails to acquire it in userland, so it calls into the kernel to block, but inbetween, thread a has released the lock? You need to be able to atomically go to sleep and mark the mutex as contested. Otherwise you have wakeup races. Do you have some other solution for this? On Thu, 30 Dec 2004, David Xu wrote: > davidxu 2004-12-30 02:56:17 UTC > > FreeBSD src repository > > Modified files: > sys/sys umtx.h > sys/kern kern_umtx.c > Log: > Make umtx_wait and umtx_wake more like linux futex does, it is > more general than previous. It also lets me implement cancelable point > in thread library. Also in theory, umtx_lock and umtx_unlock can > be implemented by using umtx_wait and umtx_wake, all atomic operations > can be done in userland without kernel's casuptr() function. > > Revision Changes Path > 1.25 +9 -41 src/sys/kern/kern_umtx.c > 1.9 +7 -9 src/sys/sys/umtx.h >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041230024007.B60504>