Feature Request: Provide non-throwing methods to open/create shared_memory_object
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- cpp
調査の方向性
まず shared_memory_object API と、参照されている managed_open_or_create_impl.hpp のコード、特に 285-338 行を読んでください。例外をスローしない create/open 操作で、POSIX と Windows において要求されたサイズを含め、セグメントが作成されたかどうかを報告する方法を確認してください。API がコンストラクター例外なしで同期のユースケースをサポートし、作成とオープンを区別できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- C++
- スター
- 185
- フォーク
- 131
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
boostorg/interprocess のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
boostorg/interprocess#196 · リアクション 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
boostorg/interprocess#279 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
boostorg/interprocess#274 · コメント 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 28/100
boostorg/interprocess#268 · コメント 4 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
boostorg/interprocess#262 · コメント 2 件 ·
boostorg/interprocess の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
flutter-webrtc/flutter-webrtc#2206 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
google-ai-edge/LiteRT-LM#3739 ·
-
Component: GLib
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
brave/brave-browser#59300 ·
-
Mute ydb/tests/functional/dstool/test_canonical_requests.py.Test.test_group_take_snapshot in main オープンai_reviewed
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
ydb-platform/ydb#53974 · コメント 3 件 ·