mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] Idea: futex() system call entry point
@ 2020-07-17  5:51 Hydro Flask
  2020-07-17  6:10 ` Florian Weimer
  0 siblings, 1 reply; 13+ messages in thread
From: Hydro Flask @ 2020-07-17  5:51 UTC (permalink / raw)
  To: musl

Hello,

I have a project that implements an API that must be AS-safe. This is a 
blocking API, so currently the only option I have to implement the 
blocking behavior is select()/read() and similar FD-based calls.

Using FDs to implement synchronization is okay but if there are very 
many threads then FD space would get exhausted (usually max 1024 FDs). 
It would be nice to use pthread_cond_wait() but that is not AS-safe 
according to POSIX.

Had the idea of using futex() but my other constraint is that the 
blocking call must also be a cancellation point. Currently calling the 
futex system call through syscall() won't work and there is no way to 
implement cancellation on top of syscall() in a portable way since 
cancellation is implementation defined.

So what if Linux libcs (and potentially others) started exposing futex() 
directly as a function call? It would need these properties to be 
useful:

* AS-safe
* cancellation point

I saw that Rich Felker already proposed this many years ago but it seems 
it never came to fruition: 
https://sourceware.org/bugzilla/show_bug.cgi?id=9712#c8

What do you think about my idea?

Hydro

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-07-18  7:57 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-17  5:51 [musl] Idea: futex() system call entry point Hydro Flask
2020-07-17  6:10 ` Florian Weimer
2020-07-17  6:29   ` Hydro Flask
2020-07-17  9:21     ` Szabolcs Nagy
2020-07-17 14:43       ` Carlos O'Donell
2020-07-17 18:57         ` Hydro Flask
2020-07-17 21:10           ` Szabolcs Nagy
2020-07-17 21:19             ` Rich Felker
2020-07-17 21:27               ` Carlos O'Donell
2020-07-17 21:37               ` Hydro Flask
2020-07-17 23:30                 ` Rich Felker
2020-07-18  1:21                   ` Hydro Flask
2020-07-18  7:56                     ` Szabolcs Nagy

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).