mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-13 05:06:30 +04:00
add missing api [ci skip]
This commit is contained in:
@@ -40,6 +40,7 @@ env.Append(
|
||||
File("pulse_protocols/pulse_glue.h"),
|
||||
File("md5_calc.h"),
|
||||
File("varint.h"),
|
||||
File("run_parallel.h"),
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
17
lib/toolbox/run_parallel.c
Normal file
17
lib/toolbox/run_parallel.c
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "run_parallel.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
static void run_parallel_thread_state(FuriThread* thread, FuriThreadState state, void* context) {
|
||||
UNUSED(context);
|
||||
|
||||
if(state == FuriThreadStateStopped) {
|
||||
furi_thread_free(thread);
|
||||
}
|
||||
}
|
||||
|
||||
void run_parallel(FuriThreadCallback callback, void* context, uint32_t stack_size) {
|
||||
FuriThread* thread = furi_thread_alloc_ex(NULL, stack_size, callback, context);
|
||||
furi_thread_set_state_callback(thread, run_parallel_thread_state);
|
||||
furi_thread_start(thread);
|
||||
}
|
||||
12
lib/toolbox/run_parallel.h
Normal file
12
lib/toolbox/run_parallel.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <core/thread.h>
|
||||
|
||||
/**
|
||||
* @brief Run function in thread, then automatically clean up thread.
|
||||
*
|
||||
* @param[in] callback pointer to a function to be executed in parallel
|
||||
* @param[in] context pointer to a user-specified object (will be passed to the callback)
|
||||
* @param[in] stack_size stack size in bytes
|
||||
*/
|
||||
void run_parallel(FuriThreadCallback callback, void* context, uint32_t stack_size);
|
||||
@@ -241,6 +241,7 @@ Header,+,lib/toolbox/pipe.h,,
|
||||
Header,+,lib/toolbox/pretty_format.h,,
|
||||
Header,+,lib/toolbox/protocols/protocol_dict.h,,
|
||||
Header,+,lib/toolbox/pulse_protocols/pulse_glue.h,,
|
||||
Header,+,lib/toolbox/run_parallel.h,,
|
||||
Header,+,lib/toolbox/saved_struct.h,,
|
||||
Header,+,lib/toolbox/simple_array.h,,
|
||||
Header,+,lib/toolbox/stream/buffered_file_stream.h,,
|
||||
@@ -3155,6 +3156,7 @@ Function,+,rpc_system_app_set_callback,void,"RpcAppSystem*, RpcAppSystemCallback
|
||||
Function,+,rpc_system_app_set_error_code,void,"RpcAppSystem*, uint32_t"
|
||||
Function,+,rpc_system_app_set_error_text,void,"RpcAppSystem*, const char*"
|
||||
Function,-,rpmatch,int,const char*
|
||||
Function,+,run_parallel,void,"FuriThreadCallback, void*, uint32_t"
|
||||
Function,+,saved_struct_get_metadata,_Bool,"const char*, uint8_t*, uint8_t*, size_t*"
|
||||
Function,+,saved_struct_load,_Bool,"const char*, void*, size_t, uint8_t, uint8_t"
|
||||
Function,+,saved_struct_save,_Bool,"const char*, const void*, size_t, uint8_t, uint8_t"
|
||||
|
||||
|
Reference in New Issue
Block a user