This commit is contained in:
Willy-JL
2024-06-24 19:00:00 +02:00
18 changed files with 292 additions and 111 deletions
+23
View File
@@ -267,6 +267,29 @@ FuriThreadState furi_thread_get_state(FuriThread* thread) {
return thread->state;
}
void furi_thread_set_signal_callback(
FuriThread* thread,
FuriThreadSignalCallback callback,
void* context) {
furi_check(thread);
furi_check(thread->state == FuriThreadStateStopped || thread == furi_thread_get_current());
thread->signal_callback = callback;
thread->signal_context = context;
}
bool furi_thread_signal(const FuriThread* thread, uint32_t signal, void* arg) {
furi_check(thread);
bool is_consumed = false;
if(thread->signal_callback) {
is_consumed = thread->signal_callback(signal, arg, thread->signal_context);
}
return is_consumed;
}
void furi_thread_start(FuriThread* thread) {
furi_check(thread);
furi_check(thread->callback);