From 1c7719f6b04331ac9e4aa37a1c82f13b592c0920 Mon Sep 17 00:00:00 2001 From: Willy-JL <49810075+Willy-JL@users.noreply.github.com> Date: Thu, 6 Jul 2023 02:40:11 +0200 Subject: [PATCH] Expose thread interfaces --- furi/core/thread.c | 36 +----------------------------------- furi/core/thread_i.h | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 35 deletions(-) create mode 100644 furi/core/thread_i.h diff --git a/furi/core/thread.c b/furi/core/thread.c index 657b867d1..2b27a81f4 100644 --- a/furi/core/thread.c +++ b/furi/core/thread.c @@ -1,4 +1,5 @@ #include "thread.h" +#include "thread_i.h" #include "kernel.h" #include "memmgr.h" #include "memmgr_heap.h" @@ -16,41 +17,6 @@ #define THREAD_NOTIFY_INDEX 1 // Index 0 is used for stream buffers -typedef struct FuriThreadStdout FuriThreadStdout; - -struct FuriThreadStdout { - FuriThreadStdoutWriteCallback write_callback; - FuriString* buffer; -}; - -struct FuriThread { - FuriThreadState state; - int32_t ret; - - FuriThreadCallback callback; - void* context; - - FuriThreadStateCallback state_callback; - void* state_context; - - char* name; - char* appid; - - FuriThreadPriority priority; - - TaskHandle_t task_handle; - size_t heap_size; - - FuriThreadStdout output; - - // Keep all non-alignable byte types in one place, - // this ensures that the size of this structure is minimal - bool is_service; - bool heap_trace_enabled; - - configSTACK_DEPTH_TYPE stack_size; -}; - static size_t __furi_thread_stdout_write(FuriThread* thread, const char* data, size_t size); static int32_t __furi_thread_stdout_flush(FuriThread* thread); diff --git a/furi/core/thread_i.h b/furi/core/thread_i.h new file mode 100644 index 000000000..2760d6a26 --- /dev/null +++ b/furi/core/thread_i.h @@ -0,0 +1,36 @@ +#pragma once + +#include "thread.h" + +typedef struct { + FuriThreadStdoutWriteCallback write_callback; + FuriString* buffer; +} FuriThreadStdout; + +struct FuriThread { + FuriThreadState state; + int32_t ret; + + FuriThreadCallback callback; + void* context; + + FuriThreadStateCallback state_callback; + void* state_context; + + char* name; + char* appid; + + FuriThreadPriority priority; + + TaskHandle_t task_handle; + size_t heap_size; + + FuriThreadStdout output; + + // Keep all non-alignable byte types in one place, + // this ensures that the size of this structure is minimal + bool is_service; + bool heap_trace_enabled; + + configSTACK_DEPTH_TYPE stack_size; +};