Skip to content

Commit

Permalink
Introduce til/latch.h, til/mutex.h and til/throttled_func.h (#10403)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
lhecker authored Jun 22, 2021
1 parent 85c485e commit 0d9a357
Show file tree
Hide file tree
Showing 20 changed files with 741 additions and 229 deletions.
3 changes: 3 additions & 0 deletions .github/actions/spelling/allow/apis.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ llu
localtime
lround
LSHIFT
mov
msappx
MULTIPLEUSE
NCHITTEST
Expand All @@ -98,6 +99,7 @@ overridable
PAGESCROLL
PICKFOLDERS
pmr
rcx
REGCLS
RETURNCMD
rfind
Expand Down Expand Up @@ -138,6 +140,7 @@ winmain
wpc
wsregex
wwinmain
xchg
XDocument
XElement
xfacet
Expand Down
3 changes: 3 additions & 0 deletions .github/actions/spelling/allow/microsoft.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,20 @@ MSVC
muxc
netcore
osgvsowi
PFILETIME
pgc
pgo
pgosweep
powerrename
powershell
propkey
pscustomobject
QWORD
robocopy
SACLs
Shobjidl
Skype
SRW
sxs
Sysinternals
sysnative
Expand Down
1 change: 0 additions & 1 deletion src/cascadia/TerminalControl/ControlCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "../../cascadia/TerminalCore/Terminal.hpp"
#include "../buffer/out/search.h"
#include "cppwinrt_utils.h"
#include "ThrottledFunc.h"

namespace ControlUnitTests
{
Expand Down
1 change: 0 additions & 1 deletion src/cascadia/TerminalControl/TermControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "../buffer/out/search.h"
#include "cppwinrt_utils.h"
#include "SearchBoxControl.h"
#include "ThrottledFunc.h"

#include "ControlInteractivity.h"

Expand Down
1 change: 0 additions & 1 deletion src/cascadia/TerminalControl/TerminalControlLib.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
<ClInclude Include="TermControlAutomationPeer.h">
<DependentUpon>TermControlAutomationPeer.idl</DependentUpon>
</ClInclude>
<ClInclude Include="ThrottledFunc.h" />
<ClInclude Include="TSFInputControl.h">
<DependentUpon>TSFInputControl.xaml</DependentUpon>
</ClInclude>
Expand Down
186 changes: 0 additions & 186 deletions src/cascadia/TerminalControl/ThrottledFunc.h

This file was deleted.

2 changes: 2 additions & 0 deletions src/cascadia/TerminalControl/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,5 @@ TRACELOGGING_DECLARE_PROVIDER(g_hTerminalControlProvider);
#include <telemetry/ProjectTelemetry.h>

#include "til.h"

#include "ThrottledFunc.h"
1 change: 1 addition & 0 deletions src/cascadia/WinRTUtils/WinRTUtils.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<ClInclude Include="pch.h" />
<ClInclude Include="ScopedResourceLoader.h" />
<ClInclude Include="inc\LibraryResources.h" />
<ClInclude Include="inc\ThrottledFunc.h" />
<ClInclude Include="inc\Utils.h" />
<ClInclude Include="inc\WtExeUtils.h" />
</ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/cascadia/WinRTUtils/WinRTUtils.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<ClInclude Include="pch.h" />
<ClInclude Include="ScopedResourceLoader.h" />
<ClInclude Include="inc\LibraryResources.h" />
<ClInclude Include="inc\ThrottledFunc.h" />
<ClInclude Include="inc\Utils.h" />
<ClInclude Include="inc\WtExeUtils.h" />
</ItemGroup>
Expand Down
Loading

0 comments on commit 0d9a357

Please sign in to comment.