[FancyZones] Move FancyZones out of the runner process (#11818)

* rename dll -> FancyZonesModuleInterface (#11488)

* [FancyZones] Rename "fancyzones/tests" -> "fancyzones/FancyZonesTests" (#11492)

* [FancyZones] Rename "fancyzones/lib" -> "fancyzones/FancyZonesLib" (#11489)

* [FancyZones] New FancyZones project. (#11544)

* [FancyZones] Allow single instance of "PowerToys.FancyZones.exe" (#11558)

* [FancyZones] Updated bug reports (#11571)

* [FancyZones] Updated installer (#11572)

* [FancyZones] Update string resources (#11596)

* [FancyZones] Terminate FancyZones with runner (#11696)

* [FancyZones] Drop support for the module interface API to save settings (#11661)

* Settings telemetry for FancyZones (#11766)

* commented out test

* enable dpi awareness for the process
This commit is contained in:
Seraphima Zykova
2021-06-23 15:48:54 +03:00
committed by GitHub
parent bdf85989fc
commit c93eb92cd0
110 changed files with 5753 additions and 5293 deletions

View File

@@ -0,0 +1,53 @@
#include "pch.h"
#include "on_thread_executor.h"
#include "CallTracer.h"
OnThreadExecutor::OnThreadExecutor() :
_shutdown_request{ false }, _worker_thread{ [this] { worker_thread(); } }
{
}
std::future<void> OnThreadExecutor::submit(task_t task)
{
auto future = task.get_future();
std::lock_guard lock{ _task_mutex };
_task_queue.emplace(std::move(task));
_task_cv.notify_one();
return future;
}
void OnThreadExecutor::cancel()
{
std::lock_guard lock{ _task_mutex };
_task_queue = {};
_task_cv.notify_one();
}
void OnThreadExecutor::worker_thread()
{
while (!_shutdown_request)
{
task_t task;
{
CallTracer callTracer(__FUNCTION__ "(loop)");
std::unique_lock task_lock{ _task_mutex };
_task_cv.wait(task_lock, [this] { return !_task_queue.empty() || _shutdown_request; });
if (_shutdown_request)
{
return;
}
task = std::move(_task_queue.front());
_task_queue.pop();
}
task();
}
}
OnThreadExecutor::~OnThreadExecutor()
{
_shutdown_request = true;
_task_cv.notify_one();
_worker_thread.join();
}