Skip to content

Commit

Permalink
Merge pull request #10 from jamisonderek/jamisonderek/timerthread
Browse files Browse the repository at this point in the history
Fix thread leak
  • Loading branch information
RocketGod-git authored Sep 14, 2024
2 parents f1fc610 + 4a7abfe commit 10cb4af
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions infrared_controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ void update_infrared_board_status(InfraredController* controller) {
}
}

static int32_t infrared_reset(void* context) {
static void infrared_reset(void* context, uint32_t arg) {
UNUSED(arg);
InfraredController* controller = (InfraredController*)context;
// furi_stream_buffer_reset(instance->stream) not exposed to the API.
// infrared_worker_rx_stop calls it internally.
infrared_worker_rx_stop(controller->worker);
infrared_worker_rx_start(controller->worker);
controller->processing_signal = false;
return 0;
}

static void infrared_rx_callback(void* context, InfraredWorkerSignal* received_signal) {
Expand Down Expand Up @@ -109,8 +109,7 @@ static void infrared_rx_callback(void* context, InfraredWorkerSignal* received_s
}

FURI_LOG_I(TAG, "RX callback completed");
FuriThread* thread = furi_thread_alloc_ex("InfraredReset", 512, infrared_reset, controller);
furi_thread_start(thread);
furi_timer_pending_callback(infrared_reset, controller, 0);
}

InfraredController* infrared_controller_alloc() {
Expand Down

0 comments on commit 10cb4af

Please sign in to comment.