Skip to contentSkip to conversation

Can I call kthread_should_stop() from user-space tasks?

DISCUSSION Frank Heckenbach 1 participant 1 message Oct 21, 2011

lore
Share & tools
lore
#0 lore raw

Hi,

is it permissible to call kthread_should_stop() from normal user-space tasks (looking at kthread.c I suppose not), and if not, is there a way to find out whether the current task is a kthread?

Reason I'm asking, I have a function that's called from both kthreads and user-space tasks which calls wait_event_interruptible(). If it's a kthread I want to add "|| kthread_should_stop()" to the condition so it can be stopped with kthread_stop() while waiting, but of course I don't want to break user-space tasks by calling kthread_should_stop() if it's invalid.