Split off RecursiveMutex from Mutex (#437)

* Split off RecursiveMutex from Mutex

* Fix

* Code quality
This commit is contained in:
Ken Van Hoeylandt
2025-12-28 12:30:54 +01:00
committed by GitHub
parent f48654d3dc
commit 3fc2ff8bc6
45 changed files with 185 additions and 177 deletions
@@ -25,7 +25,7 @@ enum class State {
*/
class AppInstance : public AppContext {
Mutex mutex = Mutex(Mutex::Type::Normal);
Mutex mutex;
const std::shared_ptr<AppManifest> manifest;
State state = State::Initial;
LaunchId launchId;
@@ -1,6 +1,6 @@
#pragma once
#include <Tactility/Mutex.h>
#include <Tactility/RecursiveMutex.h>
#include <string>
#include <vector>
@@ -20,7 +20,7 @@ public:
private:
Mutex mutex = Mutex(Mutex::Type::Recursive);
RecursiveMutex mutex;
std::vector<dirent> dir_entries;
std::string current_path;
std::string selected_child_entry;
@@ -1,6 +1,6 @@
#pragma once
#include <Tactility/Mutex.h>
#include <Tactility/RecursiveMutex.h>
#include <string>
#include <vector>
@@ -10,7 +10,7 @@ namespace tt::app::fileselection {
class State final {
Mutex mutex = Mutex(Mutex::Type::Recursive);
RecursiveMutex mutex;
std::vector<dirent> dir_entries;
std::string current_path;
std::string selected_child_entry;
@@ -1,7 +1,7 @@
#pragma once
#include <Tactility/service/wifi/Wifi.h>
#include <Tactility/Mutex.h>
#include <Tactility/RecursiveMutex.h>
namespace tt::app::wifimanage {
@@ -10,7 +10,7 @@ namespace tt::app::wifimanage {
*/
class State final {
Mutex mutex = Mutex(Mutex::Type::Recursive);
RecursiveMutex mutex;
bool scanning = false;
bool scannedAfterRadioOn = false;
service::wifi::RadioState radioState;
@@ -10,7 +10,7 @@ namespace tt::service {
class ServiceInstance final : public ServiceContext {
Mutex mutex = Mutex(Mutex::Type::Normal);
Mutex mutex;
std::shared_ptr<const ServiceManifest> manifest;
std::shared_ptr<Service> service;
State state = State::Stopped;
@@ -3,7 +3,7 @@
#include <Tactility/service/Service.h>
#include <Tactility/Mutex.h>
#include <Tactility/RecursiveMutex.h>
#include <esp_event.h>
#include <esp_http_server.h>
@@ -13,7 +13,7 @@ namespace tt::service::development {
class DevelopmentService final : public Service {
Mutex mutex = Mutex(Mutex::Type::Recursive);
RecursiveMutex mutex;
std::string deviceResponse;
network::HttpServer httpServer = network::HttpServer(
6666,
@@ -9,7 +9,7 @@
#include <Tactility/service/Service.h>
#include <Tactility/service/espnow/EspNow.h>
#include <Tactility/Mutex.h>
#include <Tactility/RecursiveMutex.h>
#include <functional>
@@ -27,7 +27,7 @@ class EspNowService final : public Service {
bool success;
};
Mutex mutex = Mutex(Mutex::Type::Recursive);
RecursiveMutex mutex;
std::vector<ReceiverSubscriptionData> subscriptions;
ReceiverSubscription lastSubscriptionId = 0;
bool enabled = false;
@@ -2,7 +2,7 @@
#include <Tactility/app/AppContext.h>
#include <Tactility/MessageQueue.h>
#include <Tactility/Mutex.h>
#include <Tactility/RecursiveMutex.h>
#include <Tactility/PubSub.h>
#include <Tactility/service/Service.h>
#include <Tactility/service/loader/Loader.h>
@@ -21,7 +21,7 @@ class GuiService final : public Service {
// Thread and lock
Thread* thread = nullptr;
Mutex mutex = Mutex(Mutex::Type::Recursive);
RecursiveMutex mutex;
PubSub<loader::LoaderService::Event>::SubscriptionHandle loader_pubsub_subscription = nullptr;
// Layers and Canvas
@@ -13,7 +13,7 @@ namespace tt::service::memorychecker {
*/
class MemoryCheckerService final : public Service {
Mutex mutex = Mutex(Mutex::Type::Recursive);
Mutex mutex;
Timer timer = Timer(Timer::Type::Periodic, [this] { onTimerUpdate(); });
// LVGL Statusbar icon
@@ -5,7 +5,7 @@
#pragma once
#include <Tactility/Thread.h>
#include <Tactility/Mutex.h>
#include <Tactility/RecursiveMutex.h>
namespace tt::service::screenshot {
@@ -22,7 +22,7 @@ class ScreenshotTask {
};
Thread* thread = nullptr;
Mutex mutex = Mutex(Mutex::Type::Recursive);
RecursiveMutex mutex;
bool interrupted = false;
bool finished = false;
ScreenshotTaskWork work;