Core: thread allocation shortcut (#2007)

* Core: thread alloc+set shortcut
* Apps: use thread allocation shortcut
* Mark some service threads as services
* Init BT as soon as possible

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Sergey Gavrilov
2022-11-23 22:49:17 +10:00
committed by GitHub
parent b9c483fbf8
commit c511c67e71
38 changed files with 94 additions and 195 deletions

View File

@@ -135,6 +135,19 @@ FuriThread* furi_thread_alloc() {
return thread;
}
FuriThread* furi_thread_alloc_ex(
const char* name,
uint32_t stack_size,
FuriThreadCallback callback,
void* context) {
FuriThread* thread = furi_thread_alloc();
furi_thread_set_name(thread, name);
furi_thread_set_stack_size(thread, stack_size);
furi_thread_set_callback(thread, callback);
furi_thread_set_context(thread, context);
return thread;
}
void furi_thread_free(FuriThread* thread) {
furi_assert(thread);
furi_assert(thread->state == FuriThreadStateStopped);

View File

@@ -60,6 +60,20 @@ typedef void (*FuriThreadStateCallback)(FuriThreadState state, void* context);
*/
FuriThread* furi_thread_alloc();
/** Allocate FuriThread, shortcut version
*
* @param name
* @param stack_size
* @param callback
* @param context
* @return FuriThread*
*/
FuriThread* furi_thread_alloc_ex(
const char* name,
uint32_t stack_size,
FuriThreadCallback callback,
void* context);
/** Release FuriThread
*
* @param thread FuriThread instance