boostorg / boostorg/interprocess
Semaphore use in signals
- Langage dominant
- C++
- Étoiles
- 185
- Forks
- 131
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
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.
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Aucun fichier ni test n’est nommé. Commencez par suivre les implémentations de sémaphores utilisées par interprocess_semaphore, en particulier les chemins spin et POSIX, ainsi que la façon dont timed_wait interagit avec SIGINT. Le travail sera considéré comme terminé lorsque le projet disposera d’une conception arrêtée pour un POSIX post qui ne lève pas d’exception et pour des informations de sécurité vis-à-vis des signaux connues à la compilation.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- cpp
- Domaine
- operating-systems
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100