|
|
Log in / Subscribe / Register

A Plumber's Wish List for Linux

A Plumber's Wish List for Linux

Posted Oct 7, 2011 20:33 UTC (Fri) by kpfleming (subscriber, #23250)
Parent article: A Plumber's Wish List for Linux

Some method of being able to poll()/epoll() on both fds *and* synchronization objects (pthread_cond_t objects, for example). Right now the only method to achieve thread-safe wakeup is to use a pipe() and poke it so that the poll() will wakeup. Unless I'm mistaken, all of these mechanisms use the same underlying basis in the kernel anyway for waking up processes, so this should be possible. It wouldn't be part of POSIX, of course.


to post comments

A Plumber's Wish List for Linux

Posted Oct 7, 2011 21:12 UTC (Fri) by cmccabe (guest, #60281) [Link] (2 responses)

Also, the ability to use epoll together with Linux AIO.

A Plumber's Wish List for Linux

Posted Oct 7, 2011 22:07 UTC (Fri) by wahern (subscriber, #37304) [Link] (1 responses)

Linux has a (struct iocb).aio_resfd member which should be set to an eventfd descriptor on which readiness will be signaled.

A Plumber's Wish List for Linux

Posted Oct 8, 2011 16:54 UTC (Sat) by cmccabe (guest, #60281) [Link]

Thanks. It looks like you can integrate POSIX aio with epoll as well by using signalfd() or similar.

A Plumber's Wish List for Linux

Posted Oct 7, 2011 21:51 UTC (Fri) by wahern (subscriber, #37304) [Link] (1 responses)

Use eventfd() instead of a pipe. In fact, use it instead of a POSIX mutex when you want to be able to poll on it. That's what it was invented for--rolling your own pollable semaphores.

A Plumber's Wish List for Linux

Posted Oct 8, 2011 14:08 UTC (Sat) by kpfleming (subscriber, #23250) [Link]

Thanks for that tip... that might be just what I've been looking for (and signalfd() looks quite handy too).

A Plumber's Wish List for Linux

Posted Oct 7, 2011 21:58 UTC (Fri) by HelloWorld (guest, #56129) [Link]

I think that this was the purpose of FUTEX_FD, see man 2 futex. It was removed in 2.6.26 though, due to being inherently racy.

A Plumber's Wish List for Linux

Posted Oct 8, 2011 9:26 UTC (Sat) by helge.bahmann (subscriber, #56804) [Link]

How about doing it the other way around, allow poll/aio/whatever to signal synchronisation objects?

http://chaoticmind.net/~hcb/kfutex/kfutex.pdf

(Yes I'm biased).


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds