From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 4323F441851 for ; Wed, 25 Mar 2020 04:43:15 +0300 (MSK) From: Nikita Pettik Date: Wed, 25 Mar 2020 04:43:04 +0300 Message-Id: <26c794f2c6fcca11d202f0fbf3b41b9490bf780c.1585097339.git.korablev@tarantool.org> In-Reply-To: References: In-Reply-To: References: Subject: [Tarantool-patches] [PATCH v2 08/10] box/error: clarify purpose of reference counting in struct error List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tarantool-patches@dev.tarantool.org Cc: v.shpilevoy@tarantool.org --- src/lib/core/diag.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lib/core/diag.h b/src/lib/core/diag.h index 675b9c6f1..665f492fa 100644 --- a/src/lib/core/diag.h +++ b/src/lib/core/diag.h @@ -71,6 +71,15 @@ struct error { error_f raise; error_f log; const struct type_info *type; + /** + * Reference counting is basically required since + * instances of this structure are available in Lua + * as well (as cdata with overloaded fields and methods + * by the means of introspection). Thus, it may turn + * out that Lua's GC attempts at releasing object + * meanwhile it is still used in C internals or vice + * versa. For details see luaT_pusherror(). + */ int refs; /** * Errno at the moment of the error -- 2.17.1