Skip to content
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-#751 create unnamed semaphore #1367

Merged

Conversation

elfenpiff
Copy link
Contributor

@elfenpiff elfenpiff commented May 20, 2022

Pre-Review Checklist for the PR Author

  1. Code follows the coding style of CONTRIBUTING.md
  2. Tests follow the best practice for testing
  3. Changelog updated in the unreleased section including API breaking changes
  4. Branch follows the naming format (iox-#123-this-is-a-branch)
  5. Commits messages are according to this guideline
    • Commit messages have the issue ID (iox-#123 commit text)
    • Commit messages are signed (git commit -s)
    • Commit author matches Eclipse Contributor Agreement (and ECA is signed)
  6. Update the PR title
    • Follow the same conventions as for commit messages
    • Link to the relevant issue
  7. Relevant issues are linked
  8. Add sensible notes for the reviewer
  9. All checks have passed (except task-list-completed)
  10. Assign PR to reviewer

Notes for Reviewer

At the moment our semaphore wrapper has the following issues:

  • is moveable but it shouldn't be
  • combines unnamed semaphore & named semaphore in one class - wastes resources, has increased unnecessary complexity
  • uses the creation pattern

This PR lays the foundation for two classes UnnamedSemaphore and NamedSemaphore which will both inherit from SemaphoreInterface which provides methods like post, wait, timedWait etc.
They won't be moveable anymore and use the builder pattern for creation.

test_posix_semaphore_interface.cpp were taken by copy from test_semaphore_module.cpp and cleaned up a bit.

Checklist for the PR Reviewer

  • Commits are properly organized and messages are according to the guideline
  • Code according to our coding style and naming conventions
  • Unit tests have been written for new behavior
    • Each unit test case has a unique UUID
  • Public API changes are documented via doxygen
  • Copyright owner are updated in the changed files
  • PR title describes the changes

Post-review Checklist for the PR Author

  1. All open points are addressed and tracked via issues

References

@elfenpiff
Copy link
Contributor Author

elfenpiff commented May 20, 2022

@elBoberido @FerdinandSpitzschnueffler For the sake of efficient reviews I created this PR without having tests. The implementation is complete, could you please take a look at the overall design and when you agree with it I would add the tests and documentation to the proposed classes.

It would be sufficient to review semaphore_interface.hpp and unnamed_semaphore.hpp to get a complete impression of the ideas and design.

Copy link
Member

@elBoberido elBoberido left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good in general

Copy link
Contributor

@FerdinandSpitzschnueffler FerdinandSpitzschnueffler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@elfenpiff elfenpiff force-pushed the iox-#751-create-unnamed-semaphore branch from 1a7aa4c to 311de8f Compare May 23, 2022 17:00
@elfenpiff elfenpiff marked this pull request as ready for review May 23, 2022 17:12
@elfenpiff elfenpiff force-pushed the iox-#751-create-unnamed-semaphore branch 2 times, most recently from e345581 to 7d5ece3 Compare May 23, 2022 17:17
@elfenpiff elfenpiff changed the title Iox #751 create unnamed semaphore iox-#751 create unnamed semaphore May 23, 2022
@elfenpiff elfenpiff self-assigned this May 23, 2022
@codecov
Copy link

codecov bot commented May 23, 2022

Codecov Report

Merging #1367 (ac6e768) into master (e7b7675) will decrease coverage by 0.17%.
The diff coverage is 44.70%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1367      +/-   ##
==========================================
- Coverage   78.82%   78.65%   -0.18%     
==========================================
  Files         373      376       +3     
  Lines       14680    14765      +85     
  Branches     2053     2065      +12     
==========================================
+ Hits        11572    11613      +41     
- Misses       2433     2471      +38     
- Partials      675      681       +6     
Flag Coverage Δ
unittests 77.89% <44.70%> (-0.16%) ⬇️
unittests_timing 15.46% <0.00%> (-0.11%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...x_hoofs/source/posix_wrapper/unnamed_semaphore.cpp 37.14% <37.14%> (ø)
...hoofs/source/posix_wrapper/semaphore_interface.cpp 46.80% <46.80%> (ø)
.../iceoryx_hoofs/posix_wrapper/unnamed_semaphore.hpp 100.00% <100.00%> (ø)
iceoryx_hoofs/source/posix_wrapper/timer.cpp 64.68% <0.00%> (-0.86%) ⬇️
iceoryx_posh/source/roudi/port_manager.cpp 84.42% <0.00%> (+0.18%) ⬆️
iceoryx_hoofs/source/concurrent/loffli.cpp 91.42% <0.00%> (+11.42%) ⬆️

@elfenpiff elfenpiff force-pushed the iox-#751-create-unnamed-semaphore branch from 0a4a4dd to d4fa175 Compare May 23, 2022 18:45
Copy link
Member

@elBoberido elBoberido left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few small things

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>
Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
…semaphore platform does not overflow

Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
… thread in unit test

Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
…tState with getValue for semaphore

Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
@elfenpiff elfenpiff merged commit dc9a5b1 into eclipse-iceoryx:master May 30, 2022
@elfenpiff elfenpiff deleted the iox-#751-create-unnamed-semaphore branch May 30, 2022 08:30
@elBoberido elBoberido linked an issue Jun 16, 2022 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The semaphore posix wrapper should not be movable.
3 participants