[Tarantool-patches] [PATCH 1/1] fiber_cond: remove rlist_shift usages

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Tue Mar 2 01:23:13 MSK 2021


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)



More information about the Tarantool-patches mailing list