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:
@@ -441,19 +441,6 @@ static int32_t cdc_process(void* p) {
|
||||
/******************************* MAIN APP **********************************/
|
||||
/***************************************************************************/
|
||||
|
||||
static 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;
|
||||
}
|
||||
|
||||
static DapApp* dap_app_alloc() {
|
||||
DapApp* dap_app = malloc(sizeof(DapApp));
|
||||
dap_app->dap_thread = furi_thread_alloc_ex("DAP Process", 1024, dap_process, dap_app);
|
||||
|
@@ -97,11 +97,8 @@ MusicPlayerWorker* music_player_worker_alloc() {
|
||||
|
||||
NoteBlockArray_init(instance->notes);
|
||||
|
||||
instance->thread = furi_thread_alloc();
|
||||
furi_thread_set_name(instance->thread, "MusicPlayerWorker");
|
||||
furi_thread_set_stack_size(instance->thread, 1024);
|
||||
furi_thread_set_context(instance->thread, instance);
|
||||
furi_thread_set_callback(instance->thread, music_player_worker_thread_callback);
|
||||
instance->thread = furi_thread_alloc_ex(
|
||||
"MusicPlayerWorker", 1024, music_player_worker_thread_callback, instance);
|
||||
|
||||
instance->volume = 1.0f;
|
||||
|
||||
|
@@ -15,11 +15,8 @@ NfcMagicWorker* nfc_magic_worker_alloc() {
|
||||
NfcMagicWorker* nfc_magic_worker = malloc(sizeof(NfcMagicWorker));
|
||||
|
||||
// Worker thread attributes
|
||||
nfc_magic_worker->thread = furi_thread_alloc();
|
||||
furi_thread_set_name(nfc_magic_worker->thread, "NfcMagicWorker");
|
||||
furi_thread_set_stack_size(nfc_magic_worker->thread, 8192);
|
||||
furi_thread_set_callback(nfc_magic_worker->thread, nfc_magic_worker_task);
|
||||
furi_thread_set_context(nfc_magic_worker->thread, nfc_magic_worker);
|
||||
nfc_magic_worker->thread =
|
||||
furi_thread_alloc_ex("NfcMagicWorker", 8192, nfc_magic_worker_task, nfc_magic_worker);
|
||||
|
||||
nfc_magic_worker->callback = NULL;
|
||||
nfc_magic_worker->context = NULL;
|
||||
|
@@ -25,11 +25,8 @@ PicopassWorker* picopass_worker_alloc() {
|
||||
PicopassWorker* picopass_worker = malloc(sizeof(PicopassWorker));
|
||||
|
||||
// Worker thread attributes
|
||||
picopass_worker->thread = furi_thread_alloc();
|
||||
furi_thread_set_name(picopass_worker->thread, "PicopassWorker");
|
||||
furi_thread_set_stack_size(picopass_worker->thread, 8192);
|
||||
furi_thread_set_callback(picopass_worker->thread, picopass_worker_task);
|
||||
furi_thread_set_context(picopass_worker->thread, picopass_worker);
|
||||
picopass_worker->thread =
|
||||
furi_thread_alloc_ex("PicopassWorker", 8192, picopass_worker_task, picopass_worker);
|
||||
|
||||
picopass_worker->callback = NULL;
|
||||
picopass_worker->context = NULL;
|
||||
|
Reference in New Issue
Block a user