terminal/src/cascadia/Remoting
Schuyler Rosefield 591a67111e
Attempt to make the monarch more thread safe. (#11189)
<!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? -->
## Summary of the Pull Request

<!-- Other than the issue solved, is this relevant to any other issues/existing PRs? --> 
## References
#11083 
#11143 

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist
* [ ] Closes #xxx
* [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA
* [x] Tests added/passed
* [ ] Documentation updated. If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx
* [ ] Schema updated.
* [ ] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

<!-- Provide a more detailed description of the PR, other things fixed or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments
While testing the save/quit features a number of issues were found that were caused by poor synchronization on the monarch, resulting in various unexpected crashes. Because this uses std collections, and I didn't see any builtin winrt multithreaded containers I went with the somewhat heavy-handed mutex approach.

e.g. 
- https://github.com/microsoft/terminal/pull/11083#issuecomment-916218353
- https://github.com/microsoft/terminal/pull/11083#issuecomment-916220521
- https://github.com/microsoft/terminal/pull/11143/#discussion_r704738433

This also makes it so that on quit peasants don't try to become the monarch, and the monarch closes their peasant last to prevent elections from happening.

<!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
Create many windows (hold down ctrl-shift-n) then use the quit action from peasants/the monarch to make sure everything closes properly.
2021-09-21 21:21:45 +00:00
..
dll Implement PGO in pipelines for AMD64 architecture; supply training test scenarios (#10071) 2021-05-13 21:12:30 +00:00
Resources/en-US Add Microsoft.Terminal.Remoting.dll (#8607) 2021-01-07 22:59:37 +00:00
CommandlineArgs.cpp Add support for running a commandline in another WT window (#8898) 2021-02-10 11:28:09 +00:00
CommandlineArgs.h Add support for running a commandline in another WT window (#8898) 2021-02-10 11:28:09 +00:00
FindTargetWindowArgs.cpp Add support for running a commandline in another WT window (#8898) 2021-02-10 11:28:09 +00:00
FindTargetWindowArgs.h Add support for naming windows with the -w parameter (#9300) 2021-03-17 19:28:01 +00:00
init.cpp Add support for running a commandline in another WT window (#8898) 2021-02-10 11:28:09 +00:00
Microsoft.Terminal.RemotingLib.vcxproj Upgrade Windows SDK to 19041 (#10118) 2021-05-20 16:04:25 +00:00
Monarch.cpp Attempt to make the monarch more thread safe. (#11189) 2021-09-21 21:21:45 +00:00
Monarch.h Attempt to make the monarch more thread safe. (#11189) 2021-09-21 21:21:45 +00:00
Monarch.idl Replace TrayIcon with NotificationIcon (#11219) 2021-09-14 16:12:40 +00:00
MonarchFactory.h Add Microsoft.Terminal.Remoting.dll (#8607) 2021-01-07 22:59:37 +00:00
packages.config Upgrade to C++/WinRT 2.0.210825.3 (#11188) 2021-09-10 21:33:13 +00:00
pch.cpp Add Microsoft.Terminal.Remoting.dll (#8607) 2021-01-07 22:59:37 +00:00
pch.h Add support for the windowingBehavior setting (#9118) 2021-02-19 21:09:17 +00:00
Peasant.cpp Replace TrayIcon with NotificationIcon (#11219) 2021-09-14 16:12:40 +00:00
Peasant.h Replace TrayIcon with NotificationIcon (#11219) 2021-09-14 16:12:40 +00:00
Peasant.idl Replace TrayIcon with NotificationIcon (#11219) 2021-09-14 16:12:40 +00:00
ProposeCommandlineResult.cpp Add support for running a commandline in another WT window (#8898) 2021-02-10 11:28:09 +00:00
ProposeCommandlineResult.h Add support for naming windows with the -w parameter (#9300) 2021-03-17 19:28:01 +00:00
RenameRequestArgs.cpp Add support for renaming windows (#9662) 2021-04-02 16:00:04 +00:00
RenameRequestArgs.h Add support for renaming windows (#9662) 2021-04-02 16:00:04 +00:00
SummonWindowBehavior.cpp Add desktop param to globalSummon; set _quake = toCurrent (#9954) 2021-04-28 17:25:48 -05:00
SummonWindowBehavior.h Add "monitor": "any"|"toCurrent"|"toMouse" setting to globalSummon (#10092) 2021-05-17 12:57:08 +00:00
SummonWindowSelectionArgs.cpp Add globalSummon action (#9854) 2021-04-28 17:13:28 -05:00
SummonWindowSelectionArgs.h Add Minimize to Tray and Tray Icon (#10368) 2021-08-12 19:54:39 +00:00
WindowActivatedArgs.cpp Add support for running a commandline in another WT window (#8898) 2021-02-10 11:28:09 +00:00
WindowActivatedArgs.h Update C++/WinRT to 2.0.210309.3 (#9437) 2021-03-10 16:04:59 -06:00
WindowManager.cpp Attempt to make the monarch more thread safe. (#11189) 2021-09-21 21:21:45 +00:00
WindowManager.h Replace TrayIcon with NotificationIcon (#11219) 2021-09-14 16:12:40 +00:00
WindowManager.idl Replace TrayIcon with NotificationIcon (#11219) 2021-09-14 16:12:40 +00:00