From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 5465D441857 for ; Fri, 20 Mar 2020 11:20:34 +0300 (MSK) Received: by mail-lf1-f65.google.com with SMTP id z22so3796254lfd.8 for ; Fri, 20 Mar 2020 01:20:34 -0700 (PDT) From: Cyrill Gorcunov Date: Fri, 20 Mar 2020 11:19:48 +0300 Message-Id: <20200320081956.30650-4-gorcunov@gmail.com> In-Reply-To: <20200320081956.30650-1-gorcunov@gmail.com> References: <20200320081956.30650-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH v15 03/11] box/txn: move fiber_set_txn to header List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tml We will use it inside wal engine. Moreover we already have a "get" function in this header which is named in_txt(). Having both get/set in one place should be more consistent. Acked-by: Konstantin Osipov Signed-off-by: Cyrill Gorcunov --- src/box/txn.c | 6 ------ src/box/txn.h | 7 +++++++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/box/txn.c b/src/box/txn.c index a4ca48224..6799f6c4b 100644 --- a/src/box/txn.c +++ b/src/box/txn.c @@ -49,12 +49,6 @@ txn_on_yield(struct trigger *trigger, void *event); static void txn_run_rollback_triggers(struct txn *txn, struct rlist *triggers); -static inline void -fiber_set_txn(struct fiber *fiber, struct txn *txn) -{ - fiber->storage.txn = txn; -} - static int txn_add_redo(struct txn *txn, struct txn_stmt *stmt, struct request *request) { diff --git a/src/box/txn.h b/src/box/txn.h index ae2c3a58f..7a7e52954 100644 --- a/src/box/txn.h +++ b/src/box/txn.h @@ -256,6 +256,13 @@ in_txn(void) return fiber()->storage.txn; } +/* Set to the current transaction (if any) */ +static inline void +fiber_set_txn(struct fiber *fiber, struct txn *txn) +{ + fiber->storage.txn = txn; +} + /** * Start a transaction explicitly. * @pre no transaction is active -- 2.20.1