From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 35B566EC40; Wed, 11 Aug 2021 23:34:37 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 35B566EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1628714077; bh=+9HeDnvtaTtMvkNaa93TiK0Q4uMp+Y5o4rbGeZ9O6XY=; h=To:Cc:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=cMO6Ol6h6KIJsMa4ed2h7X4+bx8TzL8AIXC6LGLv4v7QZAumI7J0HBYhOAubhYWKP dD+iARO56Me+N0700lHOn0Iyg7KL0e90hC2SnaybXVwzNBr+9EmTV+AdfxJh/IFKWS ehzazrh3zqjCOhG+Rj3tmi/jq2sOPzhwHOr+P6bE= Received: from smtp30.i.mail.ru (smtp30.i.mail.ru [94.100.177.90]) (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 3E10D6EC41 for ; Wed, 11 Aug 2021 23:33:34 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 3E10D6EC41 Received: by smtp30.i.mail.ru with esmtpa (envelope-from ) id 1mDuur-0007H4-EL; Wed, 11 Aug 2021 23:33:33 +0300 To: v.shpilevoy@tarantool.org, imun@tarantool.org Cc: tarantool-patches@dev.tarantool.org Date: Wed, 11 Aug 2021 23:33:29 +0300 Message-Id: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD92087353F0EC44DD972FF4A7D76DB5E242D14FEF1BD8BF4AC182A05F5380850407F8FCFDBECC0CA10C9A94FC4BD77521FAA62749C6CCAFC1E5F8FCA8D92AF83E9 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7F8E53417176C7207EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006379A6B93796C91DCB58638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D831757AA11E061B26A0BAC36FA5836593117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC081CF0AE924DC023A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F4460429728776938767073520B28585415E75ADA9F04B652EEC242312D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE902A1BE408319B2981C726BC2B329815D8FC6C240DEA7642DBF02ECDB25306B2B78CF848AE20165D0A6AB1C7CE11FEE3735DFC8FA7AC1207AD7EC71F1DB88427C4224003CC836476EA7A3FFF5B025636E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F7900637E62180BDA7F10F15EFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A213B5FB47DCBC3458F0AFF96BAACF4158235E5A14AD4A4A4625E192CAD1D9E79D94463893BF8742D0943552C08E826999 X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975C6B668463F4F89F8635432138EA847BC96F3DBB875A838A649C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EFA183FDCE24978B01699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D348F343DA43F62289F4519A7CE0925BFD37C4D762025E4B419B541A92915028014DD2E3BE58BA703F11D7E09C32AA3244C60C86B8B2E1867A226A8E2580208982924AF4FAF06DA24FDFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojKW4rnL99YhKVhDwBQ9qG0Q== X-Mailru-Sender: 583F1D7ACE8F49BD1042885CEC987B6BF0F91C86574CB234C9A94FC4BD77521F825871508D9F39707019711D9D5B048E1458020726E2BC9FD5ECBA0B92C0A936CDC7563AA7CEBD287402F9BA4338D657ED14614B50AE0675 X-Mras: Ok Subject: [Tarantool-patches] [PATCH 2/4] fiber: pass struct fiber into lbox_pushfiber instead of id X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Oleg Babin via Tarantool-patches Reply-To: olegrok@tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" From: Oleg Babin For future changes we will need the fiber object, not only its id. --- src/lua/fiber.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lua/fiber.c b/src/lua/fiber.c index 83dcbe2fa..5575f2079 100644 --- a/src/lua/fiber.c +++ b/src/lua/fiber.c @@ -114,7 +114,7 @@ lbox_create_weak_table(struct lua_State *L, const char *name) * Push a userdata for the given fiber onto Lua stack. */ static void -lbox_pushfiber(struct lua_State *L, uint64_t fid) +lbox_pushfiber(struct lua_State *L, struct fiber *f) { /* * Use 'memoize' pattern and keep a single userdata for @@ -132,6 +132,7 @@ lbox_pushfiber(struct lua_State *L, uint64_t fid) lbox_create_weak_table(L, "memoize"); } /* Find out whether the fiber is already in the memoize table. */ + uint64_t fid = f->fid; luaL_pushuint64(L, fid); lua_gettable(L, -2); if (lua_isnil(L, -1)) { @@ -501,7 +502,7 @@ fiber_create(struct lua_State *L) /* Move the arguments to the new coro */ lua_xmove(L, child_L, lua_gettop(L)); /* XXX: 'fiber' is leaked if this throws a Lua error. */ - lbox_pushfiber(L, f->fid); + lbox_pushfiber(L, f); /* Pass coro_ref via lua stack so that we don't have to pass it * as an argument of fiber_run function. * No function will work with child_L until the function is called. @@ -755,7 +756,7 @@ lbox_fiber_yield(struct lua_State *L) static int lbox_fiber_self(struct lua_State *L) { - lbox_pushfiber(L, fiber()->fid); + lbox_pushfiber(L, fiber()); return 1; } @@ -767,7 +768,7 @@ lbox_fiber_find(struct lua_State *L) uint64_t fid = luaL_touint64(L, -1); struct fiber *f = fiber_find(fid); if (f) - lbox_pushfiber(L, f->fid); + lbox_pushfiber(L, f); else lua_pushnil(L); return 1; -- 2.32.0