cvs commit: src/sys/sys umtx.h src/sys/kern kern_umtx.c

Jeff Roberson jroberson at chesapeake.net
Wed Dec 29 23:43:37 PST 2004


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
>


More information about the cvs-all mailing list