core: fix potential misorder of latch waiters
Currently the latch doesn't guarantee the order in which it is acquired by fibers, which requested it. E.g. it is possible to wake up spuriously a fiber which is yielding in the latch_lock, it will be removed from l->queue by fiber_make_ready, then it will be inserted to l->queue again, but for this time, to the head of the list instead of its original place in the queue. Fix this by using latch_waiter structure, which is linked into l->queue. Part of #7166 @TarantoolBot document Title: Update box_latch_lock description Since: 2.11 Add "Locks are acquired in the strict order as they were requested." to the box_latch_lock description in C API reference - Module latch.
Showing
- changelogs/unreleased/gh-7166-box_latch_lock-order.md 4 additions, 0 deletionschangelogs/unreleased/gh-7166-box_latch_lock-order.md
- src/lib/core/latch.h 38 additions, 18 deletionssrc/lib/core/latch.h
- test/unit/CMakeLists.txt 3 additions, 0 deletionstest/unit/CMakeLists.txt
- test/unit/latch.c 113 additions, 0 deletionstest/unit/latch.c
- test/unit/latch.result 14 additions, 0 deletionstest/unit/latch.result
Loading
Please register or sign in to comment