Re: How to detect a thread is aborted and restart it?


Li, Jun R
 

Another question still related to thread problem: now I can use fn_abort to detect a thread was forcibly aborted due to something wrong. However, it seems not possible to restart the same thread with the same struct thread variable, with the function “k_thread_create”.  When the function is called, the system is stuck. Has anyone tried to restart an aborted thread before?

 

Thank you!

 

Regards,

Jun

 

 

From: <zephyr-devel-bounces@...> on behalf of "Li, Jun R" <jun.r.li@...>
Date: Monday, December 11, 2017 at 15:37
To: "Boie, Andrew P" <andrew.p.boie@...>, Michael Rosen <michael.r.rosen@...>, "Pallala, Ramakrishna" <ramakrishna.pallala@...>, "zephyr-devel@..." <zephyr-devel@...>
Subject: Re: [Zephyr-devel] How to detect a thread is aborted and restart it?

 

Thank you, Andrew and Mike!

 

I think the function fn_abort is good enough to meet my requests. Thank you very much!

 

Regards,

Jun

 

 

From: "Boie, Andrew P" <andrew.p.boie@...>
Date: Monday, December 11, 2017 at 15:34
To: Michael Rosen <michael.r.rosen@...>, "Li, Jun R" <jun.r.li@...>, "Pallala, Ramakrishna" <ramakrishna.pallala@...>, "zephyr-devel@..." <zephyr-devel@...>
Subject: RE: [Zephyr-devel] How to detect a thread is aborted and restart it?

 

Ø  I don’t see much other way unfortunately; I think it would be nice is Zephyr added Fault hooks per thread so you could set a function to be called on a thread faulting.

 

There is a fn_abort member in struct k_thread which if not NULL, gets called when a thread goes through the k_thread_abort() code path, including when it hits a fatal exception. It's a void function that takes no parameters.

 

There appear to be no public APIs to set a thread abort function, but it should be fairly straightforward to add them.

 

HTH

Andrew

Join devel@lists.zephyrproject.org to automatically receive all group messages.