[Tarantool-patches] [PATCH v4 0/4] fiber: keep reference to userdata if fiber created once

Oleg Babin olegrok at tarantool.org
Thu Sep 9 13:45:10 MSK 2021


Thanks for your review.

On 09.09.2021 13:21, Vladimir Davydov via Tarantool-patches wrote:
> On Wed, Sep 08, 2021 at 09:19:58PM +0300, Oleg Babin via Tarantool-patches wrote:
>>    [2] https://github.com/tarantool/tarantool/pull/6280
> Reviewed in the PR.


Fixed. Diff:


diff --git a/src/lib/core/fiber.h b/src/lib/core/fiber.h
index 9ac0cbb9f..67e1a55e3 100644
--- a/src/lib/core/fiber.h
+++ b/src/lib/core/fiber.h
@@ -45,6 +45,14 @@

  #include <coro/coro.h>

+/*
+ * This constant is the same as LUA_NOREF. It should be used
+ * to initialize all Lua references in struct fiber.
+ * Since this module is independent on Lua the constant is
+ * defined directly. Value should be checked with
+ * static_assert in appropriate places to catch possible
+ * LUA_NOREF value changes in future.
+ */
  #define FIBER_LUA_NOREF (-2)

  /*
@@ -627,7 +635,7 @@ struct fiber {
              struct lua_State *stack;
              /**
               * Optional reference to userdata
-             * represented current fiber id in Lua.
+             * representing current fiber id in Lua.
               */
              int fid_ref;
              /**
diff --git a/src/lua/fiber.c b/src/lua/fiber.c
index 12836da69..95634a4d0 100644
--- a/src/lua/fiber.c
+++ b/src/lua/fiber.c
@@ -38,6 +38,7 @@

  #include <lua.h>
  #include <lauxlib.h>
+
  static_assert(FIBER_LUA_NOREF == LUA_NOREF, "FIBER_LUA_NOREF is ok");

  void



More information about the Tarantool-patches mailing list