Paul Rubin <http> wrote: > Nick Craig-Wood <[EMAIL PROTECTED]> writes: > > I believe futex is the thing you want for a modern linux. Not > > very portable though. > > That's really cool, but I don't see how it can be a pure userspace > operation if the futex has a timeout. The kernel must need to keep > track of the timeouts. However, since futexes can be woken by any > thread, the whole thing can be done with just one futex. In fact the > doc mentions something about using a file descriptor to support > asynchronous wakeups, but it's confusing whether that applies here.
No it isn't pure user space, only for the non-contended case which for most locks is the most frequent operation. Futex operation is entirely userspace for the non-contended case. The kernel is only involved to arbitrate the contended case. As any sane design will strive for non-contension, futexes are also optimised for this situation. -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list