mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-12 12:42:30 +04:00
Revert "Revert "Furi Thread: don't use thread pointer after FuriThreadStateStopped callback (#1799)""
This reverts commit 7df70d7c62.
This commit is contained in:
@@ -85,7 +85,6 @@ static void furi_thread_body(void* context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
furi_assert(thread->state == FuriThreadStateRunning);
|
furi_assert(thread->state == FuriThreadStateRunning);
|
||||||
furi_thread_set_state(thread, FuriThreadStateStopped);
|
|
||||||
|
|
||||||
if(thread->is_service) {
|
if(thread->is_service) {
|
||||||
FURI_LOG_E(
|
FURI_LOG_E(
|
||||||
@@ -99,7 +98,10 @@ static void furi_thread_body(void* context) {
|
|||||||
furi_assert(pvTaskGetThreadLocalStoragePointer(NULL, 0) != NULL);
|
furi_assert(pvTaskGetThreadLocalStoragePointer(NULL, 0) != NULL);
|
||||||
vTaskSetThreadLocalStoragePointer(NULL, 0, NULL);
|
vTaskSetThreadLocalStoragePointer(NULL, 0, NULL);
|
||||||
|
|
||||||
vTaskDelete(thread->task_handle);
|
// from here we can't use thread pointer
|
||||||
|
furi_thread_set_state(thread, FuriThreadStateStopped);
|
||||||
|
|
||||||
|
vTaskDelete(NULL);
|
||||||
furi_thread_catch();
|
furi_thread_catch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,7 +207,9 @@ void furi_thread_start(FuriThread* thread) {
|
|||||||
bool furi_thread_join(FuriThread* thread) {
|
bool furi_thread_join(FuriThread* thread) {
|
||||||
furi_assert(thread);
|
furi_assert(thread);
|
||||||
|
|
||||||
while(thread->state != FuriThreadStateStopped) {
|
furi_check(furi_thread_get_current() != thread);
|
||||||
|
|
||||||
|
while(eTaskGetState(thread->task_handle) != eDeleted) {
|
||||||
furi_delay_ms(10);
|
furi_delay_ms(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user