Furi: proper thread id in heap tracking (#572)
This commit is contained in:
parent
20fe544b4f
commit
fe3bedbd3c
@ -16,7 +16,7 @@ struct FuriThread {
|
|||||||
void* state_context;
|
void* state_context;
|
||||||
|
|
||||||
osThreadAttr_t attr;
|
osThreadAttr_t attr;
|
||||||
osThreadId_t id;
|
volatile osThreadId_t id;
|
||||||
|
|
||||||
bool heap_trace_enabled;
|
bool heap_trace_enabled;
|
||||||
size_t heap_size;
|
size_t heap_size;
|
||||||
@ -37,15 +37,16 @@ void furi_thread_body(void* context) {
|
|||||||
furi_assert(thread->state == FuriThreadStateStarting);
|
furi_assert(thread->state == FuriThreadStateStarting);
|
||||||
furi_thread_set_state(thread, FuriThreadStateRunning);
|
furi_thread_set_state(thread, FuriThreadStateRunning);
|
||||||
|
|
||||||
|
osThreadId_t thread_id = osThreadGetId();
|
||||||
if(thread->heap_trace_enabled == true) {
|
if(thread->heap_trace_enabled == true) {
|
||||||
memmgr_heap_enable_thread_trace(thread->id);
|
memmgr_heap_enable_thread_trace(thread_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
thread->ret = thread->callback(thread->context);
|
thread->ret = thread->callback(thread->context);
|
||||||
|
|
||||||
if(thread->heap_trace_enabled == true) {
|
if(thread->heap_trace_enabled == true) {
|
||||||
thread->heap_size = memmgr_heap_get_thread_memory(thread->id);
|
thread->heap_size = memmgr_heap_get_thread_memory(thread_id);
|
||||||
memmgr_heap_disable_thread_trace(thread->id);
|
memmgr_heap_disable_thread_trace(thread_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
furi_assert(thread->state == FuriThreadStateRunning);
|
furi_assert(thread->state == FuriThreadStateRunning);
|
||||||
|
Loading…
Reference in New Issue
Block a user