Skip to content

Commit

Permalink
make z_close take session by mutable reference
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisBiryukov91 committed Oct 4, 2024
1 parent 637ee5b commit 6857e8f
Show file tree
Hide file tree
Showing 43 changed files with 513 additions and 614 deletions.
1 change: 1 addition & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ Functions
.. doxygenfunction:: z_close

.. doxygenfunction:: z_session_loan
.. doxygenfunction:: z_session_loan_mut
.. doxygenfunction:: z_session_drop

.. doxygenfunction:: z_info_zid
Expand Down
10 changes: 5 additions & 5 deletions docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Publish
z_put(z_loan(s), z_loan(key_expr), z_move(payload), NULL);
z_close(z_move(s));
z_drop(z_move(s));
return 0;
}
Expand Down Expand Up @@ -83,7 +83,7 @@ Subscribe
z_owned_subscriber_t sub;
if (z_declare_subscriber(&sub, z_loan(s), z_loan(key_expr) z_move(callback), NULL) != 0) {
printf("Unable to create Zenoh subscriber.\n");
z_close(z_move(s));
z_drop(z_move(s));
exit(-1);
}
Expand All @@ -93,7 +93,7 @@ Subscribe
}
z_undeclare_subscriber(z_move(sub));
z_close(z_move(s));
z_drop(z_move(s));
return 0;
}
Expand Down Expand Up @@ -140,7 +140,7 @@ Query
z_drop(reply);
z_drop(channel);
z_close(z_move(s));
z_drop(z_move(s));
return 0;
}
Expand Down Expand Up @@ -206,6 +206,6 @@ Queryable
}
z_undeclare_queryable(z_move(qable));
z_close(z_move(s));
z_drop(z_move(s));
return 0;
}
2 changes: 1 addition & 1 deletion examples/z_delete.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ int main(int argc, char** argv) {
printf("Delete failed...\n");
}

z_close(z_move(s), NULL);
z_drop(z_move(s));
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/z_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ int main(int argc, char** argv) {
}

z_drop(z_move(handler));
z_close(z_move(s), NULL);
z_drop(z_move(s));
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/z_get_liveliness.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ int main(int argc, char** argv) {

z_drop(z_move(reply));
z_drop(z_move(handler));
z_close(z_move(s), NULL);
z_drop(z_move(s));
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/z_get_shm.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ int main(int argc, char** argv) {
}

z_drop(z_move(handler));
z_close(z_move(s), NULL);
z_drop(z_move(s));

z_drop(z_move(shm));
z_drop(z_move(provider));
Expand Down
2 changes: 1 addition & 1 deletion examples/z_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ int main(int argc, char** argv) {
z_closure(&callback2, print_zid, NULL, NULL);
z_info_peers_zid(z_loan(s), z_move(callback2));

z_close(z_move(s), NULL);
z_drop(z_move(s));
}

void print_help() {
Expand Down
2 changes: 1 addition & 1 deletion examples/z_liveliness.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ int main(int argc, char** argv) {
printf("Undeclaring liveliness token...\n");
z_drop(z_move(token));

z_close(z_move(s), NULL);
z_drop(z_move(s));
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/z_non_blocking_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ int main(int argc, char** argv) {
}
z_drop(z_move(reply));
z_drop(z_move(handler));
z_close(z_move(s), NULL);
z_drop(z_move(s));
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/z_ping.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ int main(int argc, char** argv) {
z_undeclare_subscriber(z_move(sub));
z_undeclare_publisher(z_move(pub));
z_drop(z_move(mutex));
z_close(z_move(session), NULL);
z_drop(z_move(session));
}

void print_help() {
Expand Down
2 changes: 1 addition & 1 deletion examples/z_ping_shm.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ int main(int argc, char** argv) {
z_undeclare_subscriber(z_move(sub));
z_undeclare_publisher(z_move(pub));
z_drop(z_move(mutex));
z_close(z_move(session), NULL);
z_drop(z_move(session));

z_drop(z_move(shm));
z_drop(z_move(provider));
Expand Down
2 changes: 1 addition & 1 deletion examples/z_pong.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ int main(int argc, char** argv) {
z_sleep_s(1);
}
z_undeclare_subscriber(z_move(sub));
z_close(z_move(session), NULL);
z_drop(z_move(session));
}

void print_help() {
Expand Down
2 changes: 1 addition & 1 deletion examples/z_pub.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ int main(int argc, char** argv) {
#endif

z_undeclare_publisher(z_move(pub));
z_close(z_move(s), NULL);
z_drop(z_move(s));
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/z_pub_attachment.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ int main(int argc, char** argv) {

z_undeclare_publisher(z_move(pub));

z_close(z_move(s), NULL);
z_drop(z_move(s));

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/z_pub_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ int main(int argc, char** argv) {
}

ze_undeclare_publication_cache(z_move(pub_cache));
z_close(z_move(s), NULL);
z_drop(z_move(s));

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/z_pub_shm.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ int main(int argc, char** argv) {
#endif

z_undeclare_publisher(z_move(pub));
z_close(z_move(s), NULL);
z_drop(z_move(s));

z_drop(z_move(provider));
z_drop(z_move(layout));
Expand Down
2 changes: 1 addition & 1 deletion examples/z_pub_shm_thr.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ int main(int argc, char **argv) {
}

z_undeclare_publisher(z_move(pub));
z_close(z_move(s), NULL);
z_drop(z_move(s));

z_drop(z_move(shm));
z_drop(z_move(provider));
Expand Down
2 changes: 1 addition & 1 deletion examples/z_pub_thr.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ int main(int argc, char** argv) {
}

z_undeclare_publisher(z_move(pub));
z_close(z_move(s), NULL);
z_drop(z_move(s));
}

void print_help() {
Expand Down
2 changes: 1 addition & 1 deletion examples/z_pull.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ int main(int argc, char** argv) {
}
}
z_undeclare_subscriber(z_move(sub));
z_close(z_move(s), NULL);
z_drop(z_move(s));
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/z_put.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ int main(int argc, char** argv) {
printf("Put failed...\n");
}

z_close(z_move(s), NULL);
z_drop(z_move(s));
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/z_query_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ int main(int argc, char** argv) {
}

ze_undeclare_querying_subscriber(z_move(sub));
z_close(z_move(s), NULL);
z_drop(z_move(s));

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/z_queryable.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ int main(int argc, char **argv) {
}

z_undeclare_queryable(z_move(qable));
z_close(z_move(s), NULL);
z_drop(z_move(s));
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/z_queryable_shm.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ int main(int argc, char **argv) {
}

z_undeclare_queryable(z_move(qable));
z_close(z_move(s), NULL);
z_drop(z_move(s));
z_drop(z_move(layout));
z_drop(z_move(provider));
return 0;
Expand Down
2 changes: 1 addition & 1 deletion examples/z_queryable_with_channels.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ int main(int argc, char** argv) {

z_undeclare_queryable(z_move(qable));
z_drop(z_move(handler));
z_close(z_move(s), NULL);
z_drop(z_move(s));
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/z_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ int main(int argc, char **argv) {
}

z_undeclare_subscriber(z_move(sub));
z_close(z_move(s), NULL);
z_drop(z_move(s));
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/z_sub_attachment.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ int main(int argc, char** argv) {
}

z_undeclare_subscriber(z_move(sub));
z_close(z_move(s), NULL);
z_drop(z_move(s));
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/z_sub_liveliness.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ int main(int argc, char** argv) {
}

z_undeclare_subscriber(z_move(sub));
z_close(z_move(s), NULL);
z_drop(z_move(s));
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/z_sub_shm.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ int main(int argc, char **argv) {
}

z_undeclare_subscriber(z_move(sub));
z_close(z_move(s), NULL);
z_drop(z_move(s));
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/z_sub_thr.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ int main(int argc, char **argv) {

z_undeclare_subscriber(z_move(sub));
z_undeclare_keyexpr(z_move(declared_ke), z_loan(s));
z_close(z_move(s), NULL);
z_drop(z_move(s));
return 0;
}

Expand Down
Loading

0 comments on commit 6857e8f

Please sign in to comment.