Can I call kthread_should_stop() fromuser-space tasks?

From: Frank Heckenbach
Date: Fri Oct 21 2011 - 10:58:31 EST


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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/