Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: tarantool-patches@dev.tarantool.org, sergepetrenko@tarantool.org,
	gorcunov@gmail.com
Subject: [Tarantool-patches] [PATCH 1/1] fiber_cond: remove rlist_shift usages
Date: Mon,  1 Mar 2021 23:23:13 +0100	[thread overview]
Message-ID: <2ba579eef6f31d17a1670a6eaf31492366963ad9.1614637331.git.v.shpilevoy@tarantool.org> (raw)

Fiber_cond to pop fibers from the queue uses rlist_shift() +
fiber_wakeup() calls. The shift wasn't needed, because fibers are
linked with 'state' member, which is moved by fiber_wakeup()
anyway.

Closes #5855
---
Branch: http://github.com/tarantool/tarantool/tree/gerold103/gh-5855-optimize-fiber-cond
Issue: https://github.com/tarantool/tarantool/issues/5855

 src/lib/core/fiber_cond.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/lib/core/fiber_cond.c b/src/lib/core/fiber_cond.c
index 71bb2d04d..3624dffd4 100644
--- a/src/lib/core/fiber_cond.c
+++ b/src/lib/core/fiber_cond.c
@@ -84,7 +84,7 @@ fiber_cond_signal(struct fiber_cond *e)
 {
 	if (! rlist_empty(&e->waiters)) {
 		struct fiber *f;
-		f = rlist_shift_entry(&e->waiters, struct fiber, state);
+		f = rlist_first_entry(&e->waiters, struct fiber, state);
 		fiber_wakeup(f);
 	}
 }
@@ -94,7 +94,7 @@ fiber_cond_broadcast(struct fiber_cond *e)
 {
 	while (! rlist_empty(&e->waiters)) {
 		struct fiber *f;
-		f = rlist_shift_entry(&e->waiters, struct fiber, state);
+		f = rlist_first_entry(&e->waiters, struct fiber, state);
 		fiber_wakeup(f);
 	}
 }
-- 
2.24.3 (Apple Git-128)


             reply	other threads:[~2021-03-01 22:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-01 22:23 Vladislav Shpilevoy via Tarantool-patches [this message]
2021-03-02  7:37 ` Cyrill Gorcunov via Tarantool-patches
2021-03-02  7:54   ` Cyrill Gorcunov via Tarantool-patches
2021-03-02  9:04   ` Serge Petrenko via Tarantool-patches
2021-03-03 21:43     ` Vladislav Shpilevoy via Tarantool-patches
2021-03-03 21:37 ` Vladislav Shpilevoy via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2ba579eef6f31d17a1670a6eaf31492366963ad9.1614637331.git.v.shpilevoy@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=gorcunov@gmail.com \
    --cc=sergepetrenko@tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 1/1] fiber_cond: remove rlist_shift usages' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox