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 C9C386F3F2; Fri, 3 Sep 2021 23:50:33 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C9C386F3F2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1630702233; bh=+9HeDnvtaTtMvkNaa93TiK0Q4uMp+Y5o4rbGeZ9O6XY=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=ThdCebfIhYi9u4cQS16weVPAefQFBRWL86g9eZ4OXe5UL5zeJR00W56gZpkocyyxr UHVcqAQ2qfkAkY8jsxiqQdR60zP5EnSRoUe7Y4UNYUkWUIylEGsyZwAstuH7yvR0nc ZcJ2D4Xztb2FC/wy6ImAyx8wj4nQlIkLt5AT/pv8= Received: from smtp29.i.mail.ru (smtp29.i.mail.ru [94.100.177.89]) (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 6298E70202 for ; Fri, 3 Sep 2021 23:49:22 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 6298E70202 Received: by smtp29.i.mail.ru with esmtpa (envelope-from ) id 1mMG7l-0007LS-Fv; Fri, 03 Sep 2021 23:49:21 +0300 To: v.shpilevoy@tarantool.org, imun@tarantool.org Date: Fri, 3 Sep 2021 23:49:16 +0300 Message-Id: <901780b4afc2b3cc5690da12d7c9baa91402de07.1630701714.git.babinoleg@mail.ru> 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: 4F1203BC0FB41BD9D96C1EA41D18F4D5B144C25AA2C86F19FE5C2012F6F3B614182A05F53808504026B1F050DE0A6FF61653274335DE069546F40C19FBFFB0A21D09E43A61EBAA91 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7FDE19FEC90BA7BD7C2099A533E45F2D0395957E7521B51C2CFCAF695D4D8E9FCEA1F7E6F0F101C6778DA827A17800CE7364F8074C6DFACE28F08D7030A58E5AD1A62830130A00468AEEEE3FBA3A834EE7353EFBB55337566A3881D9F5F3D43CB24F3A4FF9F79E2923C485D61EEFF4D2AA471835C12D1D9774AD6D5ED66289B5278DA827A17800CE7A3E989B1926288338941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B6B4CA5BC574AE2910CC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB8D32BA5DBAC0009BE9E8FC8737B5C22499876B82E8454D7C476E601842F6C81A12EF20D2F80756B5F7E9C4E3C761E06A776E601842F6C81A127C277FBC8AE2E8B09C89A32BBE95F8C3AA81AA40904B5D9DBF02ECDB25306B2201CA6A4E26CD07C3BBE47FD9DD3FB595F5C1EE8F4F765FC72CEEB2601E22B093A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E735C8D5298E42E60C1FC4224003CC83647689D4C264860C145E X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A213B5FB47DCBC3458F0AFF96BAACF4158235E5A14AD4A4A4625E192CAD1D9E79DB8BF922E402C092CBED5322E09C7E3F9 X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975CA3881D9F5F3D43CB24F3A4FF9F79E2923C485D61EEFF4D2A9C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EFCCE3E035A672CDEE699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34738A88CA0C70A558EF1956223D84996E71B101E64A915740A929A8D51F84C3F8C08A29D5F06F0FBF1D7E09C32AA3244C90CD8BCA566D0720E5F0156E695D53D260759606DA2E136A927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj0HWrnICxeoqgGizgJtFQTA== X-Mailru-Sender: 583F1D7ACE8F49BD1042885CEC987B6B1B43EF4D1E02B11F1653274335DE0695CA71892AC981DD5F7019711D9D5B048E1458020726E2BC9FD5ECBA0B92C0A936CDC7563AA7CEBD287402F9BA4338D657ED14614B50AE0675 X-Mras: Ok Subject: [Tarantool-patches] [PATCH v3 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 Cc: tarantool-patches@dev.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