Feature Request: Provide non-throwing methods to open/create shared_memory_object
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- cpp
- Ambito
- operating-systems
Direzione di ricerca
Iniziare leggendo l’API di shared_memory_object e il codice referenziato di managed_open_or_create_impl.hpp, in particolare le righe 285-338. Determinare come le operazioni di creazione/apertura che non generano eccezioni possano indicare se un segmento è stato creato, inclusa una dimensione richiesta su POSIX e Windows. Il lavoro è completato quando l’API supporta il caso d’uso di sincronizzazione senza eccezioni nei costruttori e distingue tra creazione e apertura.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
My use case is as follows. I need to synchronize multiple processes or threads initializing a shared memory region. No select process can be considered the "master", so it is not known which of the processes will actually create and initialize the shared memory object. The natural solution would be to construct shared_memory_object(open_or_create), but this introduces a problem that the caller doesn't know whether the shared memory was created or an existing region was opened. This is important to later decide whether the caller should resize the region to the desired size and initialize the contents or try and adopt the existing one. (Testing the region size for 0 is not safe because it introduces a race condition.)
The current API does not provide a way to implement this efficiently. It is possible to implement a loop trying to construct shared_memory_object(open_only) or shared_memory_object(create_only), but the constructors throw on failure, which is unnecessary overhead and awkward to use in the caller. Indeed, you have implemented exactly that here. It would be better to have a set of methods in shared_memory_object that allow to create or open the shared memory and able to report the result without throwing - for example, through an error_code argument.
Also, please consider adding a way to create a shared memory segment of a given size. On POSIX, this would allow the aforementioned loop to be implemented in Boost.Interprocess instead of user's code. On Windows, CreateFileMappingW already accepts the desired size. This new API would also have to provide a result so that the caller knows whether a new segment was created or not.
- Lingua principale
- C++
- Stelle
- 185
- Fork
- 131
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di boostorg/interprocess
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
boostorg/interprocess#196 · 1 reazione ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
boostorg/interprocess#279 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
boostorg/interprocess#274 · 1 commento ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 28/100
boostorg/interprocess#268 · 4 commenti ·
-
Semaphore use in signals Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
boostorg/interprocess#262 · 2 commenti ·
Tutte le issue di boostorg/interprocess
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
flutter-webrtc/flutter-webrtc#2206 ·
-
litertlm-android AAR ships no consumer ProGuard rules → "mid == null" SIGABRT in minified apps Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
google-ai-edge/LiteRT-LM#3739 ·
-
Component: GLib
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
brave/brave-browser#59300 ·
-
Mute ydb/tests/functional/dstool/test_canonical_requests.py.Test.test_group_take_snapshot in main Apertaai_reviewed
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
ydb-platform/ydb#53974 · 3 commenti ·