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

1112 Callback: Add sendMsg() which takes MsgPtrThief #1119

Merged
merged 6 commits into from
Oct 30, 2020

Conversation

JacobDomagala
Copy link
Contributor

@JacobDomagala JacobDomagala commented Oct 20, 2020

Fixes #1112

Changes:

  1. added sendMsg(MsgPtrThief) -> takes ownership of the message
  2. added send(args...) overload -> create (using args) and then send message
  3. applied new API for examples/tests

@codecov
Copy link

codecov bot commented Oct 20, 2020

Codecov Report

Merging #1119 into develop will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1119      +/-   ##
===========================================
- Coverage    75.92%   75.90%   -0.02%     
===========================================
  Files          713      713              
  Lines        26940    26928      -12     
===========================================
- Hits         20453    20441      -12     
  Misses        6487     6487              
Impacted Files Coverage Δ
src/vt/pipe/pipe_manager.h 100.00% <ø> (ø)
examples/callback/callback.cc 98.43% <100.00%> (-0.03%) ⬇️
examples/callback/callback_context.cc 100.00% <100.00%> (ø)
src/vt/pipe/callback/cb_union/cb_raw_base.h 100.00% <100.00%> (ø)
src/vt/pipe/callback/cb_union/cb_raw_base.impl.h 78.94% <100.00%> (+1.16%) ⬆️
tests/unit/pipe/test_callback_bcast.cc 100.00% <100.00%> (ø)
...it/pipe/test_callback_bcast_collection.extended.cc 96.66% <100.00%> (-0.08%) ⬇️
tests/unit/pipe/test_callback_func_ctx.cc 97.56% <100.00%> (-0.06%) ⬇️
tests/unit/pipe/test_callback_send.cc 100.00% <100.00%> (ø)
...nit/pipe/test_callback_send_collection.extended.cc 97.97% <100.00%> (-0.10%) ⬇️
... and 3 more

@JacobDomagala JacobDomagala force-pushed the 1112-add-msgptrthief-for-callbacks branch 2 times, most recently from 0fb6789 to 84c5c2d Compare October 23, 2020 15:03
@JacobDomagala JacobDomagala marked this pull request as ready for review October 23, 2020 15:57
Copy link
Contributor

@cz4rs cz4rs 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 to me 👍

@@ -128,9 +128,15 @@ struct CallbackRawBaseSingle {
bool null() const { return cb_.null(); }
bool valid() const { return cb_.valid(); }

template <typename MsgT, typename... Args>
void send(Args... args);

template <typename MsgT>
void send(MsgT* msg);
Copy link
Member

@PhilMiller PhilMiller Oct 23, 2020

Choose a reason for hiding this comment

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

As elsewhere, do we want to mark this overload as deprecated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would assume it's widely used in EMPIRE, not sure if we want to flood it with warnings. We could add doxygen \deprecated command though.
Can you comment on that @lifflander?

@@ -232,12 +238,22 @@ struct CallbackTyped : CallbackRawBaseSingle {
cb_ = std::move(other.cb_);
}

template <typename MsgU, typename... Args>
void send(Args... args) {
static_assert(std::is_same<MsgT, MsgU>::value, "Required exact type match");
Copy link
Member

Choose a reason for hiding this comment

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

I could see us wanting to loosen this to derivation, or even convertibility. No need to do that here and now, though.

tutorial/tutorial_1g.h Outdated Show resolved Hide resolved
@@ -128,9 +128,15 @@ struct CallbackRawBaseSingle {
bool null() const { return cb_.null(); }
bool valid() const { return cb_.valid(); }

template <typename MsgT, typename... Args>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Now that I'm looking at this, is there some way to avoid having to specify MsgT when the type is known by the (e.g, callback Callback<MyMsg>)?

@JacobDomagala JacobDomagala force-pushed the 1112-add-msgptrthief-for-callbacks branch from 84c5c2d to 1f66454 Compare October 27, 2020 00:10
@lifflander lifflander merged commit ead0f4b into develop Oct 30, 2020
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.

Callbacks do not use MsgThief or accept MsgSharedPtr
4 participants