Thread (2 messages) 2 messages, 2 authors, 2011-09-13

kthread Working

From: Rajat Sharma <hidden>
Date: 2011-09-13 10:01:51

On Mon, Sep 12, 2011 at 3:47 PM, Gaurav Mahajan
[off-list ref] wrote:
Hi,

I have a douby regarding? kthread working.

How can we check that a kthread is working or exited.
It? may exit beacuse of call to do_exit in threadfn or callling kthread_stop
function on?task_struct (correct me if i am weong).

I want to check?that?if kthread has finished its work or not.
If not then what should?I call so that?kthread gets killed.
If it is finshhed then which function?I should?call so that as to?free
kthread resources.

Regards,
Gaurav Mahajan.







_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
kthread_stop function should itself block untill thread gets killed.
However if thread is already killed, its task_struct won't be valid.
If its your thread, it should be fairly possible for you keep keep
single exit point, i.e. notify this thread to stop using
'kthread_stop'.

However if you are upto hacking some kernel thread, kthread_stop() may
not work on already exited task, as there won't be any way to identify
a killed thread. Probably you should avoid such design choices.

-Rajat
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help