Feature Request: Provide non-throwing methods to open/create shared_memory_object
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- cpp
- Lĩnh vực
- operating-systems
Hướng nghiên cứu
Bắt đầu bằng cách đọc API của shared_memory_object và mã được tham chiếu trong managed_open_or_create_impl.hpp, đặc biệt là các dòng 285-338. Xác định cách các thao tác create/open không ném exception có thể báo cáo liệu một segment đã được tạo hay chưa, bao gồm kích thước được yêu cầu trên POSIX và Windows. Hoàn tất khi API hỗ trợ use case đồng bộ hóa mà không có exception trong constructor và phân biệt được việc tạo với việc mở.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- C++
- Star
- 185
- Fork
- 131
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của boostorg/interprocess
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
boostorg/interprocess#196 · 1 reaction ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
boostorg/interprocess#279 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
boostorg/interprocess#274 · 1 bình luận ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 28/100
boostorg/interprocess#268 · 4 bình luận ·
-
Semaphore use in signals Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
boostorg/interprocess#262 · 2 bình luận ·
Tất cả issue của boostorg/interprocess
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
flutter-webrtc/flutter-webrtc#2206 ·
-
litertlm-android AAR ships no consumer ProGuard rules → "mid == null" SIGABRT in minified apps Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
google-ai-edge/LiteRT-LM#3739 ·
-
Component: GLib
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
brave/brave-browser#59300 ·
-
Mute ydb/tests/functional/dstool/test_canonical_requests.py.Test.test_group_take_snapshot in main Đang mởai_reviewed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
ydb-platform/ydb#53974 · 3 bình luận ·