boostorg / boostorg/interprocess
Semaphore use in signals
- Lingua principale
- C++
- Stelle
- 185
- Fork
- 131
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
I am using interprocess' semaphore in conjunction with timed_wait, and I need to be able to handle SIGINT to terminate the waiting early. Looking into the implementation, I can see that I am getting the spin semaphore internally, which suggests to me that `post()`ing it from the signal handler is safe, since it is effectively just an atomic increment.
This would likely not hold in other types of internal implementations of the semaphore. For example, while POSIX implementation seems to be fine in the first line (it just uses `sem_post`), it can later throw an exception.
This leads me to two thoughts:
1. Can we have a variant of the POSIX post() that would not throw an exception?
2. Can we add compile-time introspection for signal safety of the chosen semaphore implementation? So that one can do something like `static_assert(boost::interprocess::interprocess_semaphore::signal_safe_post)`.
I am happy to contribute such improvements if there's a consensus.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Non viene indicato alcun file o test. Inizia tracciando le implementazioni dei semafori utilizzate da interprocess_semaphore, in particolare i percorsi spin e POSIX, e il modo in cui timed_wait interagisce con SIGINT. Il lavoro è completato quando il progetto dispone di un design definito per un POSIX post che non genera eccezioni e di informazioni sulla signal safety disponibili a tempo di compilazione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- cpp
- Ambito
- operating-systems
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100