mORMot2 Daily每日上游提交速读

TOSLightLock 改用原生 futex,并修复 ICU 死锁

今天的提交对 mORMot 2 核心同步原语做了较大改动。TOSLightLock 现在在 Linux 上使用原生 futex,在 Windows 8+ 上使用 WaitOnAddress,有望显著改善争用下的性能。此外修复了一处 ICU 库死锁,异步网络轮询也增加了边界检查。

要点

  • TOSLightLock 在 Linux 上使用原生 futex,在 Windows 8+ 上使用 WaitOnAddress。
  • TIcuLibrary 修复了创建共享转换器时的死锁。
  • TAsyncConnections 修复了线程轮询中可能的越界问题。
  • 自适应自旋等待机制被提取到 core base 单元。

升级建议

Teams pushing heavy multithreaded workloads on Linux or Windows 8+ should benefit from the TOSLightLock upgrade. The ICU deadlock fix is recommended for applications dealing with internationalization.

版本号2.4.16618 → 2.4.16628
提交10
行数+404 -312
阅读2 分钟

10 条中的 10 条 · 上游 10 次提交

主题
# 条目 类别 单元
1 高 修复加载 ICU 转换器时的死锁 Corrects the unlock logic in TIcuLibrary.SharedUcnvGet(). The previous code mistakenly released a converter-specific lock instead of the main library lock after populating the converter cache. 修复 mormot.core.os 87dbb9fc+3-3

core: fix deadlock in TIcuLibrary

影响

避免多个线程同时向 ICU 库请求文本转换器时发生死锁。

Arnaud · 21:44 UTC · 在 GitHub 上查看该提交 →

2 高 TOSLightLock uses WaitOnAddress on Windows 8+ Upgrades TOSLightLock on Windows to use the WaitOnAddress and WakeByAddressSingle API (introduced in Windows 8), moving away from Slim Reader/Writer (SRW) locks. 性能 mormot.core.os+3 17a26fa9+106-124

core: TOSLightLock now uses WaitOnAddress/WakeByAddressSingle on Win8+

影响

Faster lock acquisition on Windows 8 and newer, especially under high contention, by avoiding SRW lock overhead.

Arnaud Bouchez · 19:39 UTC · 在 GitHub 上查看该提交 →

3 高 TOSLightLock upgraded to use native futex on Linux Replaces the underlying Linux implementation of TOSLightLock with a direct 32-bit futex syscall instead of a TRTLCriticalSection. It falls back to spin-and-wait on older kernels. 性能 mormot.core.os 64d1d6db+106-23

core: TOsLightLock uses a futex on Linux

影响

Significantly improves requests-per-second and threading stability on Linux backends. It is now as fast as TLightLock on the uncontended fast path.

Arnaud Bouchez · 17:29 UTC · 在 GitHub 上查看该提交 →

4 中 Fixed TOSLightLock fallback on Android and Delphi POSIX Restores the TRTLCriticalSection fallback for TOSLightLock on platforms without native futex or pthread_mutex support, like Android and Delphi POSIX. The previous commits inadvertently broke this fallback. 修复 mormot.core.os+1 cabcd0ec+41-40

core: another pass of TOsLightLock

影响

Applications running on Android or compiled with Delphi for POSIX will compile and run correctly again. No impact on Windows or FPC Linux.

Arnaud · 22:35 UTC · 在 GitHub 上查看该提交 →

5 中 Fixed late loading of Windows 8 synchronization API Moves the runtime loading of API-MS-Win-Core-Synch-l1-2-0.dll to happen after the OS version has been properly populated into OSVersion32. 修复 mormot.core.os a426a84d+14-14

core: fixed API-MS-Win-Core-Synch-l1-2-0.dll loading

影响

Resolves a bug where the new futex API was not initialized correctly on modern Windows versions because the version check failed at initialization time.

Arnaud Bouchez · 19:41 UTC · 在 GitHub 上查看该提交 →

6 中 Fixed potential bounds error in asynchronous connections Updates TAsyncConnections.ThreadPollingWakeupLocked to check for <= 0 instead of exactly 0 when inspecting spare events. 修复 mormot.net.async 440d9e9d+3-3

net: fixed potential out of range in TAsyncConnections.ThreadPollingWakeupLocked;

影响

Prevents potential out-of-range errors or negative event counters from causing issues in the async polling thread loop.

Arnaud Bouchez · 17:33 UTC · 在 GitHub 上查看该提交 →

7 低 Published a raw DoPause procedure Extracts the CPU pause logic (the pause opcode on x86, yield on ARM) into a globally available DoPause procedure in mormot.core.base. 新功能 mormot.core.base 4cd5cff1+17-2

core: let publish a raw DoPause procedure

影响

Developers can now explicitly call DoPause in custom spin loops to reduce CPU power consumption and cache traffic.

公开 API

  • DoPauseadded — A cross-platform procedure that invokes CPU pause or yield instructions.

Arnaud Bouchez · 17:28 UTC · 在 GitHub 上查看该提交 →

8 低 Moved NextSpin to mormot.core.base Moves the adaptive spin-wait function NextSpin() and its associated SPIN_FACTOR and SPIN_COUNT constants from mormot.core.os into the lower-level mormot.core.base unit. 内部重构 mormot.core.base+1 268d8600+91-85

core: moved NextSpin() to mormot.core.base

影响

No direct impact on application code. It allows simpler units without OS dependencies to use the adaptive spin logic.

Arnaud Bouchez · 17:27 UTC · 在 GitHub 上查看该提交 →

9 低 Refactored TIcuLibrary internal locking fields Changes the internal locking fields in TIcuLibrary from PtrUInt to cardinal to match the expected types for TLightLock primitives. 内部重构 mormot.core.os 1f1fe8df+17-12

core: fixed TIcuLibrary locking code

影响

No impact on application code, internal refactoring only.

Arnaud Bouchez · 19:45 UTC · 在 GitHub 上查看该提交 →

10 低 Updated TOSLightLock usage comments Updates code comments referencing TOSLightLock across several units to reflect the new Windows 8+ and Linux futex behaviors. 杂项 mormot.core.mvc+3 043d364d+6-6

core: fixed TOSLightLock usage comments in code

影响

No impact on application code, internal refactoring only.

Arnaud Bouchez · 17:33 UTC · 在 GitHub 上查看该提交 →

上游活动 每日提交数 · 最近 60 天
提交977
活跃天数44/60
最忙一天2026-09-30
峰值60
2026-08-15: 0 commits2026-08-16: 0 commits2026-08-17: 0 commits2026-08-18: 0 commits2026-08-19: 0 commits2026-08-20: 0 commits2026-08-21: 0 commits2026-08-22: 0 commits2026-08-23: 0 commits2026-08-24: 0 commits2026-08-25: 0 commits2026-08-26: 0 commits2026-08-27: 26 commits2026-08-28: 11 commits2026-08-29: 10 commits2026-08-30: 1 commit2026-08-31: 23 commits2026-09-01: 0 commits2026-09-02: 20 commits2026-09-03: 29 commits2026-09-04: 35 commits2026-09-05: 13 commits2026-09-06: 0 commits2026-09-07: 0 commits2026-09-08: 23 commits2026-09-09: 10 commits2026-09-10: 17 commits2026-09-11: 23 commits2026-09-12: 14 commits2026-09-13: 9 commits2026-09-14: 7 commits2026-09-15: 4 commits2026-09-16: 24 commits2026-09-17: 26 commits2026-09-18: 21 commits2026-09-19: 59 commits2026-09-20: 13 commits2026-09-21: 5 commits2026-09-22: 34 commits2026-09-23: 17 commits2026-09-24: 57 commits2026-09-25: 22 commits2026-09-26: 26 commits2026-09-27: 0 commits2026-09-28: 2 commits2026-09-29: 19 commits2026-09-30: 60 commits2026-10-01: 26 commits2026-10-02: 30 commits2026-10-03: 32 commits2026-10-04: 15 commits2026-10-05: 1 commit2026-10-06: 26 commits2026-10-07: 37 commits2026-10-08: 27 commits2026-10-09: 35 commits2026-10-10: 33 commits2026-10-11: 9 commits2026-10-12: 11 commits2026-10-13: 35 commits
2026-08-152026-10-13