7 years, 12 months ago.

RTOS Thread --- attach_terminate_hook

Dears, is there any simple example how to use attach_terminate_hook function ?

Thank you

P.M.

1 Answer

7 years, 12 months ago.

Hi Pavel,

The documentation of the function is here. There is nothing fancy about this, just call the function with your callback as argument:

void on_thread_terminate(osThreadId thread_id) { 
  // your code here
}

int main() { 
  Thread::attach_terminate_hook(on_thread_terminate);
}