[PR #10403] [MERGED] Introduce til/latch.h, til/mutex.h and til/throttled_func.h #28024

Open
opened 2026-01-31 09:25:50 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/10403
Author: @lhecker
Created: 6/10/2021
Status: Merged
Merged: 6/22/2021
Merged by: @undefined

Base: mainHead: dev/lhecker/til-goodies


📝 Commits (10+)

  • 9ff7fc9 Introduce til/mutex.h and til/throttled_func.h
  • 9325834 Fix AuditMode errors
  • 0615204 Remove remaining bits of WinRT from til::throttled_func
  • 738316d Make til::throttled_func member naming more consistent
  • 582af8b Fix x86 compilation issue
  • a80d2a9 Add unit tests
  • 28bc69e Fix formatting
  • cc15525 Fix spelling check
  • 5bc68da Improve documentation
  • fa05441 Fix spelling check

📊 Changes

20 files changed (+742 additions, -229 deletions)

View changed files

📝 .github/actions/spelling/allow/apis.txt (+3 -0)
📝 .github/actions/spelling/allow/microsoft.txt (+4 -0)
📝 src/cascadia/TerminalControl/ControlCore.h (+0 -1)
📝 src/cascadia/TerminalControl/TermControl.h (+0 -1)
📝 src/cascadia/TerminalControl/TerminalControlLib.vcxproj (+0 -1)
src/cascadia/TerminalControl/ThrottledFunc.h (+0 -186)
📝 src/cascadia/TerminalControl/pch.h (+2 -0)
📝 src/cascadia/WinRTUtils/WinRTUtils.vcxproj (+1 -0)
📝 src/cascadia/WinRTUtils/WinRTUtils.vcxproj.filters (+1 -0)
src/cascadia/WinRTUtils/inc/ThrottledFunc.h (+141 -0)
src/inc/til/latch.h (+86 -0)
src/inc/til/mutex.h (+108 -0)
📝 src/inc/til/string.h (+22 -0)
src/inc/til/throttled_func.h (+206 -0)
src/til/ut_til/VisualizeControlCodesTests.cpp (+0 -23)
src/til/ut_til/mutex.cpp (+46 -0)
src/til/ut_til/string.cpp (+55 -0)
src/til/ut_til/throttled_func.cpp (+42 -0)
📝 src/til/ut_til/til.unit.tests.vcxproj (+11 -9)
📝 src/til/ut_til/til.unit.tests.vcxproj.filters (+14 -8)

📄 Description

This commit introduce three new til features:

  • "til/latch.h": A std::latch clone, until we're on C++20.
  • "til/mutex.h": A safe mutex wrapper, which only allows you access to the protected data after locking it. No more forgetting to lock mutexes!
  • "til/throttled_func.h": Function invocation throttling used to be available as the ThrottledFunc class already. But this class is vastly more efficient and doesn't rely on any WinRT types.

This PR also adds a til::ends_with string helper which is til::starts_with counterpart.

Validation Steps Performed

  • Scrollbar throttling still works as it used to ✔️
  • No performance regressions when printing big.txt ✔️

Closes #10393


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/10403 **Author:** [@lhecker](https://github.com/lhecker) **Created:** 6/10/2021 **Status:** ✅ Merged **Merged:** 6/22/2021 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/lhecker/til-goodies` --- ### 📝 Commits (10+) - [`9ff7fc9`](https://github.com/microsoft/terminal/commit/9ff7fc902ff8da117d8eede7b48c321beccdf237) Introduce til/mutex.h and til/throttled_func.h - [`9325834`](https://github.com/microsoft/terminal/commit/9325834e6f115cae10f0521eb7834cedda8cbda6) Fix AuditMode errors - [`0615204`](https://github.com/microsoft/terminal/commit/0615204392ff79882453ebc4a9141ebd5c0fb2f7) Remove remaining bits of WinRT from til::throttled_func - [`738316d`](https://github.com/microsoft/terminal/commit/738316de83bf71358b00868801b104e4ed83cb16) Make til::throttled_func member naming more consistent - [`582af8b`](https://github.com/microsoft/terminal/commit/582af8b09689dae2c9a0dfdfac705f99fcb7f3a3) Fix x86 compilation issue - [`a80d2a9`](https://github.com/microsoft/terminal/commit/a80d2a9adfcbe09c625fe27232b6d22656c58ea5) Add unit tests - [`28bc69e`](https://github.com/microsoft/terminal/commit/28bc69e7d6849d45d14bb6317024a4e7044a5845) Fix formatting - [`cc15525`](https://github.com/microsoft/terminal/commit/cc15525fa960cd9de274ee2c23244f36929da874) Fix spelling check - [`5bc68da`](https://github.com/microsoft/terminal/commit/5bc68daaa66487e03de71752a0aaa4b28cdcd7c4) Improve documentation - [`fa05441`](https://github.com/microsoft/terminal/commit/fa0544156ef7ed27cb0e53b823f3879760689839) Fix spelling check ### 📊 Changes **20 files changed** (+742 additions, -229 deletions) <details> <summary>View changed files</summary> 📝 `.github/actions/spelling/allow/apis.txt` (+3 -0) 📝 `.github/actions/spelling/allow/microsoft.txt` (+4 -0) 📝 `src/cascadia/TerminalControl/ControlCore.h` (+0 -1) 📝 `src/cascadia/TerminalControl/TermControl.h` (+0 -1) 📝 `src/cascadia/TerminalControl/TerminalControlLib.vcxproj` (+0 -1) ➖ `src/cascadia/TerminalControl/ThrottledFunc.h` (+0 -186) 📝 `src/cascadia/TerminalControl/pch.h` (+2 -0) 📝 `src/cascadia/WinRTUtils/WinRTUtils.vcxproj` (+1 -0) 📝 `src/cascadia/WinRTUtils/WinRTUtils.vcxproj.filters` (+1 -0) ➕ `src/cascadia/WinRTUtils/inc/ThrottledFunc.h` (+141 -0) ➕ `src/inc/til/latch.h` (+86 -0) ➕ `src/inc/til/mutex.h` (+108 -0) 📝 `src/inc/til/string.h` (+22 -0) ➕ `src/inc/til/throttled_func.h` (+206 -0) ➖ `src/til/ut_til/VisualizeControlCodesTests.cpp` (+0 -23) ➕ `src/til/ut_til/mutex.cpp` (+46 -0) ➕ `src/til/ut_til/string.cpp` (+55 -0) ➕ `src/til/ut_til/throttled_func.cpp` (+42 -0) 📝 `src/til/ut_til/til.unit.tests.vcxproj` (+11 -9) 📝 `src/til/ut_til/til.unit.tests.vcxproj.filters` (+14 -8) </details> ### 📄 Description This commit introduce three new `til` features: * "til/latch.h": A std::latch clone, until we're on C++20. * "til/mutex.h": A safe mutex wrapper, which only allows you access to the protected data after locking it. No more forgetting to lock mutexes! * "til/throttled_func.h": Function invocation throttling used to be available as the `ThrottledFunc` class already. But this class is vastly more efficient and doesn't rely on any WinRT types. This PR also adds a `til::ends_with` string helper which is `til::starts_with` counterpart. ## Validation Steps Performed * Scrollbar throttling still works as it used to ✔️ * No performance regressions when printing big.txt ✔️ Closes #10393 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:25:50 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#28024