Cleanup/improvements

This commit is contained in:
Ken Van Hoeylandt 2025-09-01 00:08:26 +02:00
parent 1aa5daf1b0
commit 601b7733d4
9 changed files with 12 additions and 19 deletions

View File

@ -13,9 +13,7 @@ namespace tt {
/** /**
* A dictionary that maps keys (strings) onto several atomary types. * A dictionary that maps keys (strings) onto several atomary types.
*/ */
class Bundle { class Bundle final {
private:
typedef uint32_t Hash; typedef uint32_t Hash;

View File

@ -19,7 +19,8 @@ namespace tt {
* Generally, one task would dispatch the execution, * Generally, one task would dispatch the execution,
* while the other thread consumes and executes the work. * while the other thread consumes and executes the work.
*/ */
class Dispatcher { class Dispatcher final {
public: public:
typedef std::function<void()> Function; typedef std::function<void()> Function;

View File

@ -5,7 +5,7 @@
namespace tt { namespace tt {
/** Starts a Thread to process dispatched messages */ /** Starts a Thread to process dispatched messages */
class DispatcherThread { class DispatcherThread final {
Dispatcher dispatcher; Dispatcher dispatcher;
std::unique_ptr<Thread> thread; std::unique_ptr<Thread> thread;

View File

@ -8,8 +8,7 @@ namespace tt {
/** /**
* Wrapper for FreeRTOS xEventGroup. * Wrapper for FreeRTOS xEventGroup.
*/ */
class EventFlag { class EventFlag final {
private:
struct EventGroupHandleDeleter { struct EventGroupHandleDeleter {
void operator()(EventGroupHandle_t handleToDelete) { void operator()(EventGroupHandle_t handleToDelete) {

View File

@ -7,7 +7,7 @@ namespace tt {
/** Publish and subscribe to messages in a thread-safe manner. */ /** Publish and subscribe to messages in a thread-safe manner. */
template<typename DataType> template<typename DataType>
class PubSub { class PubSub final {
struct Subscription { struct Subscription {
uint64_t id; uint64_t id;

View File

@ -21,8 +21,6 @@ namespace tt {
*/ */
class Semaphore final : public Lock { class Semaphore final : public Lock {
private:
struct SemaphoreHandleDeleter { struct SemaphoreHandleDeleter {
void operator()(QueueHandle_t handleToDelete) { void operator()(QueueHandle_t handleToDelete) {
assert(!kernel::isIsr()); assert(!kernel::isIsr());

View File

@ -22,9 +22,7 @@ namespace tt {
* interrupt that will write to the buffer (the writer), and only one task or * interrupt that will write to the buffer (the writer), and only one task or
* interrupt that will read from the buffer (the reader). * interrupt that will read from the buffer (the reader).
*/ */
class StreamBuffer { class StreamBuffer final {
private:
struct StreamBufferHandleDeleter { struct StreamBufferHandleDeleter {
void operator()(StreamBufferHandle_t handleToDelete) { void operator()(StreamBufferHandle_t handleToDelete) {

View File

@ -1,6 +1,5 @@
#pragma once #pragma once
#include "CoreDefines.h"
#include "RtosCompatTask.h" #include "RtosCompatTask.h"
#include <functional> #include <functional>
@ -11,7 +10,7 @@ namespace tt {
typedef TaskHandle_t ThreadId; typedef TaskHandle_t ThreadId;
class Thread { class Thread final {
public: public:
@ -184,8 +183,8 @@ public:
static uint32_t awaitFlags(uint32_t flags, uint32_t options, uint32_t timeout); static uint32_t awaitFlags(uint32_t flags, uint32_t options, uint32_t timeout);
}; };
#define THREAD_PRIORITY_SERVICE Thread::Priority::High constexpr auto THREAD_PRIORITY_SERVICE = Thread::Priority::High;
#define THREAD_PRIORITY_RENDER Thread::Priority::Higher constexpr auto THREAD_PRIORITY_RENDER = Thread::Priority::Higher;
#define THREAD_PRIORITY_ISR Thread::Priority::Critical constexpr auto THREAD_PRIORITY_ISR = Thread::Priority::Critical;
} // namespace } // namespace

View File

@ -5,7 +5,7 @@
namespace tt { namespace tt {
inline static StreamBufferHandle_t createStreamBuffer(size_t size, size_t triggerLevel) { static StreamBufferHandle_t createStreamBuffer(size_t size, size_t triggerLevel) {
assert(size != 0); assert(size != 0);
return xStreamBufferCreate(size, triggerLevel); return xStreamBufferCreate(size, triggerLevel);
} }