-
Notifications
You must be signed in to change notification settings - Fork 400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Iox #33 efficient named pipes with semaphores #847
Iox #33 efficient named pipes with semaphores #847
Conversation
e3c82db
to
060d645
Compare
Codecov Report
@@ Coverage Diff @@
## master #847 +/- ##
==========================================
- Coverage 75.10% 74.93% -0.18%
==========================================
Files 332 332
Lines 11880 11970 +90
Branches 2007 2013 +6
==========================================
+ Hits 8923 8970 +47
- Misses 2188 2227 +39
- Partials 769 773 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
… into explicit policy Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
f8765c5
to
36c3c22
Compare
Signed-off-by: Christian Eltzschig <me@elchris.org>
iceoryx_hoofs/include/iceoryx_hoofs/internal/posix_wrapper/posix_call.inl
Show resolved
Hide resolved
9a16aea
to
22aece1
Compare
Restore cout/cerr/clog flags when changing Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
…Handle in semaphore Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
22aece1
to
568a7af
Compare
Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
iceoryx_hoofs/include/iceoryx_hoofs/posix_wrapper/named_pipe.hpp
Outdated
Show resolved
Hide resolved
|
||
std::atomic<uint64_t> initializationGuard{INVALID_DATA}; | ||
using semaphoreMemory_t = uint8_t[sizeof(Semaphore)]; | ||
alignas(alignof(Semaphore)) semaphoreMemory_t semaphores[2U]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alignas(Semaphore)
is sufficient.
Wouldn't it make more sense to use two cxx::optional<Semaphore>
for this task?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly no since I require direct access to uninitialized memory and the optional does not provide me this kind of access.
The semaphore shouldn't be moved and the idea here is to have the memory available and do a placement new with the creation pattern to avoid the move which would come with the standard create
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The list of reason why I don't like this pattern grows. We need to switch to the good old factory method pattern.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@elBoberido but even the factory pattern would be somehow ugly for objects that are neither copyable nor movable.
The user has a place in mind where the object should life and then provides the factory with a pointer to that memory and the arguments.
But the memory handling should be abstracted! Didn't we had the idea for an uninitialized typed array which provides you the raw correctly aligned memory?
This could then be also used as a building block for the list, forward list, vector, optional etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. This has the same problem. I thought about expected<Error> whatever(optional<Semaphore>& s, ...)
could be added to the semaphore. Or maybe something generic where only an emplace
method is expected.
The uninitialized array is quite a low building block and shouldn't be overused. After all, you have to take care of calling the dtor by yourself, take care of the alignment and such stuff. We already have a typed container for uninitialized data which takes care of all of that. It's the optional.
Signed-off-by: Christian Eltzschig <me@elchris.org>
Pre-Review Checklist for the PR Author
iox-#123-this-is-a-branch
)iox-#123 commit text
)git commit -s
)task-list-completed
)Notes for Reviewer
Checklist for the PR Reviewer
Post-review Checklist for the PR Author
References