From 5d7cbec34cd5e473d5768b39054d99bc72ddad62 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Thu, 27 Apr 2023 12:55:30 +1000 Subject: Move DB interactions to a background thread --- src/database/include/env_esp.hpp | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'src/database/include/env_esp.hpp') diff --git a/src/database/include/env_esp.hpp b/src/database/include/env_esp.hpp index b8819b05..cf5a20e1 100644 --- a/src/database/include/env_esp.hpp +++ b/src/database/include/env_esp.hpp @@ -2,9 +2,8 @@ #include #include +#include -#include "freertos/FreeRTOS.h" -#include "freertos/queue.h" #include "leveldb/env.h" #include "leveldb/status.h" @@ -89,25 +88,6 @@ class EspEnv : public leveldb::Env { void BackgroundThreadMain(); private: - // Stores the work item data in a Schedule() call. - // - // Instances are constructed on the thread calling Schedule() and used on the - // background thread. - // - // This structure is thread-safe beacuse it is immutable. - struct BackgroundWorkItem { - explicit BackgroundWorkItem(void (*f)(void*), void* a) - : function(f), arg(a) {} - - void (*const function)(void*); - void* const arg; - }; - - std::mutex background_work_mutex_; - bool started_background_thread_; - - QueueHandle_t background_work_queue_; - InMemoryLockTable locks_; // Thread-safe. }; -- cgit v1.2.3