From: Cyrill Gorcunov <gorcunov@gmail.com> To: tml <tarantool-patches@dev.tarantool.org> Cc: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> Subject: [Tarantool-patches] [PATCH 10/11] relay: use verbose names for fibers Date: Thu, 12 Nov 2020 22:51:20 +0300 [thread overview] Message-ID: <20201112195121.191366-11-gorcunov@gmail.com> (raw) In-Reply-To: <20201112195121.191366-1-gorcunov@gmail.com> Usually we use _f postfix for fiber's loop functions and using same postfix for the fiber instance itself looks inconsistent. Same time if we grep for "struct fibers" we see a number of places where fiber instances are postfixed with _fiber. Thus lets make the same in relay fiber code: - use explicit reader_fiber name for a reader - use relay_fiber name for the joint relay fiber which depends on the reader, moreover this explicit name allows to note that the reader cancels the bound fiber if error happens. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com> --- src/box/relay.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/box/relay.cc b/src/box/relay.cc index fa3dc3a75..a9522d30c 100644 --- a/src/box/relay.cc +++ b/src/box/relay.cc @@ -539,7 +539,7 @@ int relay_reader_f(va_list ap) { struct relay *relay = va_arg(ap, struct relay *); - struct fiber *relay_f = va_arg(ap, struct fiber *); + struct fiber *relay_fiber = va_arg(ap, struct fiber *); struct ibuf ibuf; struct ev_io io; @@ -557,7 +557,7 @@ relay_reader_f(va_list ap) } } catch (Exception *e) { relay_set_error(relay, e); - fiber_cancel(relay_f); + fiber_cancel(relay_fiber); } ibuf_destroy(&ibuf); return 0; @@ -688,9 +688,10 @@ relay_subscribe_f(va_list ap) /* Start fiber for receiving replica acks. */ char name[FIBER_NAME_MAX]; snprintf(name, sizeof(name), "%s:%s", fiber()->name, "reader"); - struct fiber *reader = fiber_new_xc(name, relay_reader_f); - fiber_set_joinable(reader, true); - fiber_start(reader, relay, fiber()); + struct fiber *reader_fiber = fiber_new_xc(name, relay_reader_f); + struct fiber *relay_fiber = fiber(); + fiber_set_joinable(reader_fiber, true); + fiber_start(reader_fiber, relay, relay_fiber); /* * If the replica happens to be up to date on subscribe, @@ -771,8 +772,8 @@ relay_subscribe_f(va_list ap) wal_clear_watcher(&relay->wal_watcher, cbus_process); /* Join ack reader fiber. */ - fiber_cancel(reader); - fiber_join(reader); + fiber_cancel(reader_fiber); + fiber_join(reader_fiber); /* Destroy cpipe to tx. */ cbus_unpair(&relay->tx_pipe, &relay->relay_pipe, -- 2.26.2
next prev parent reply other threads:[~2020-11-12 19:53 UTC|newest] Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-11-12 19:51 [Tarantool-patches] [PATCH 00/11] qsync: code refactoring Cyrill Gorcunov 2020-11-12 19:51 ` [Tarantool-patches] [PATCH 01/11] build: add more ignore paths for tags target Cyrill Gorcunov 2020-11-16 13:09 ` Cyrill Gorcunov 2020-11-20 23:55 ` Vladislav Shpilevoy 2020-11-21 12:09 ` Cyrill Gorcunov 2020-11-12 19:51 ` [Tarantool-patches] [PATCH 02/11] vclock: vclock_get - drop misleading masking Cyrill Gorcunov 2020-11-12 19:51 ` [Tarantool-patches] [PATCH 03/11] vclock: vclock_inc -- add assert() to catch overflow Cyrill Gorcunov 2020-11-13 9:30 ` Serge Petrenko 2020-11-12 19:51 ` [Tarantool-patches] [PATCH 04/11] txn: txn_commit_async -- drop redundant variable Cyrill Gorcunov 2020-11-13 9:31 ` Serge Petrenko 2020-11-20 23:55 ` Vladislav Shpilevoy 2020-11-21 12:30 ` Cyrill Gorcunov 2020-11-21 13:29 ` Vladislav Shpilevoy 2020-11-21 16:14 ` Cyrill Gorcunov 2020-11-12 19:51 ` [Tarantool-patches] [PATCH 05/11] qsync: rename txn_limbo::instance_id to owner_id Cyrill Gorcunov 2020-11-13 9:37 ` Serge Petrenko 2020-11-12 19:51 ` [Tarantool-patches] [PATCH 06/11] qsync: txn_limbo_append -- use owner_id in argument name Cyrill Gorcunov 2020-11-13 9:43 ` Serge Petrenko 2020-11-13 10:11 ` Cyrill Gorcunov 2020-11-20 23:55 ` Vladislav Shpilevoy 2020-11-12 19:51 ` [Tarantool-patches] [PATCH 07/11] qsync: move limbo owner transition into separate helper Cyrill Gorcunov 2020-11-13 9:47 ` Serge Petrenko 2020-11-13 10:12 ` Cyrill Gorcunov 2020-11-20 23:55 ` Vladislav Shpilevoy 2020-11-12 19:51 ` [Tarantool-patches] [PATCH 08/11] qsync: txn_limbo_wait_confirm -- refactor code a bit Cyrill Gorcunov 2020-11-13 9:56 ` Serge Petrenko 2020-11-20 23:55 ` Vladislav Shpilevoy 2020-11-12 19:51 ` [Tarantool-patches] [PATCH 09/11] qsync: drop redundant type convention Cyrill Gorcunov 2020-11-13 10:11 ` Serge Petrenko 2020-11-13 10:13 ` Cyrill Gorcunov 2020-11-13 10:19 ` Serge Petrenko 2020-11-20 23:55 ` Vladislav Shpilevoy 2020-11-12 19:51 ` Cyrill Gorcunov [this message] 2020-11-13 10:17 ` [Tarantool-patches] [PATCH 10/11] relay: use verbose names for fibers Serge Petrenko 2020-11-13 10:28 ` Cyrill Gorcunov 2020-11-20 23:55 ` Vladislav Shpilevoy 2020-11-12 19:51 ` [Tarantool-patches] [PATCH 11/11] raft: drop redundant argument Cyrill Gorcunov 2020-11-13 10:18 ` Serge Petrenko 2020-11-20 23:54 ` [Tarantool-patches] [PATCH 00/11] qsync: code refactoring Vladislav Shpilevoy 2020-11-24 23:24 ` Vladislav Shpilevoy 2020-11-23 23:26 ` Vladislav Shpilevoy 2020-11-24 6:52 ` Cyrill Gorcunov 2020-11-24 21:41 ` Alexander V. Tikhonov
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20201112195121.191366-11-gorcunov@gmail.com \ --to=gorcunov@gmail.com \ --cc=tarantool-patches@dev.tarantool.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH 10/11] relay: use verbose names for fibers' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox