Feature Request: Provide non-throwing methods to open/create shared_memory_object
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- cpp
- Área
- operating-systems
Línea de trabajo
Comience leyendo la API de shared_memory_object y el código referenciado de managed_open_or_create_impl.hpp, especialmente las líneas 285-338. Determine cómo las operaciones de creación/apertura que no lanzan excepciones pueden indicar si se creó un segmento, incluido un tamaño solicitado en POSIX y Windows. Se considera terminado cuando la API admite el caso de uso de sincronización sin excepciones en los constructores y distingue entre creación y apertura.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- C++
- Estrellas
- 185
- Forks
- 131
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de boostorg/interprocess
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
boostorg/interprocess#196 · 1 reacción ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
boostorg/interprocess#279 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
boostorg/interprocess#274 · 1 comentario ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 28/100
boostorg/interprocess#268 · 4 comentarios ·
-
Semaphore use in signals Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
boostorg/interprocess#262 · 2 comentarios ·
Todos los issues de boostorg/interprocess
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
flutter-webrtc/flutter-webrtc#2206 ·
-
litertlm-android AAR ships no consumer ProGuard rules → "mid == null" SIGABRT in minified apps Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
google-ai-edge/LiteRT-LM#3739 ·
-
Component: GLib
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
brave/brave-browser#59300 ·
-
Mute ydb/tests/functional/dstool/test_canonical_requests.py.Test.test_group_take_snapshot in main Abiertoai_reviewed
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
ydb-platform/ydb#53974 · 3 comentarios ·