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

Fix ping-pong examples (#226) (#227) #228

Merged
merged 5 commits into from
Jul 6, 2023

Conversation

cguimaraes
Copy link
Member

Fix #226 and #227

@cguimaraes cguimaraes requested a review from p-avital July 5, 2023 13:32
@cguimaraes
Copy link
Member Author

@imstevenpmwork can you double check if it fixes both of your issues?

@imstevenpmwork
Copy link
Contributor

imstevenpmwork commented Jul 6, 2023

Hello Carlos, thanks for the quick reply. I tested this PR with the same system and I confirm both of the problems are solved. Code changes look good too to me

@@ -79,8 +100,8 @@ int main(int argc, char** argv) {
_z_mutex_unlock(&mutex);
z_free(results);
z_free(data);
z_drop(z_move(sub));
z_drop(z_move(pub));
Copy link
Contributor

Choose a reason for hiding this comment

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

z_drop should be favored in c11 examples

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

while (getchar() != 'q') {
}
z_drop(z_move(sub));

z_undeclare_subscriber(z_move(sub));
Copy link
Contributor

Choose a reason for hiding this comment

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

prefer z_drop

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

z_undeclare_subscriber(z_move(sub));
z_undeclare_publisher(z_move(pub));
z_close(z_move(session));
z_undeclare_subscriber(z_subscriber_move(&sub));
Copy link
Contributor

Choose a reason for hiding this comment

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

don't switch this to z_drop, it's a c99 example (leaving the comment just in case)

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

@@ -77,8 +97,8 @@ int main(int argc, char** argv) {
_z_mutex_unlock(&mutex);
z_free(results);
z_free(data);
z_drop(z_move(sub));
z_drop(z_move(pub));
z_undeclare_publisher(z_move(pub));
Copy link
Contributor

Choose a reason for hiding this comment

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

prefer z_drop

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

while (getchar() != 'q') {
}
z_drop(z_move(sub));

z_undeclare_subscriber(z_move(sub));
Copy link
Contributor

Choose a reason for hiding this comment

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

prefer z_drop

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

@cguimaraes cguimaraes merged commit 2ba610c into eclipse-zenoh:master Jul 6, 2023
@cguimaraes cguimaraes deleted the fix-ping-pong-examples branch July 6, 2023 09:52
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.

[Bug] SegFault when running z_ping & z_pong examples
3 participants