1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>kthread_stop</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux Device Drivers"><link rel="up" href="ch01s07.html" title="Internal Functions"><link rel="prev" href="API-kthread-bind.html" title="kthread_bind"><link rel="next" href="API-kthread-worker-fn.html" title="kthread_worker_fn"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">kthread_stop</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-kthread-bind.html">Prev</a> </td><th width="60%" align="center">Internal Functions</th><td width="20%" align="right"> <a accesskey="n" href="API-kthread-worker-fn.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-kthread-stop"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>kthread_stop — 2 stop a thread created by <code class="function">kthread_create</code>. 3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">kthread_stop </b>(</code></td><td>struct task_struct * <var class="pdparam">k</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idp1108133804"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>k</code></em></span></dt><dd><p> 4 thread created by <code class="function">kthread_create</code>. 5 </p></dd></dl></div></div><div class="refsect1"><a name="idp1108135764"></a><h2>Description</h2><p> 6 Sets <code class="function">kthread_should_stop</code> for <em class="parameter"><code>k</code></em> to return true, wakes it, and 7 waits for it to exit. This can also be called after <code class="function">kthread_create</code> 8 instead of calling <code class="function">wake_up_process</code>: the thread will exit without 9 calling <code class="function">threadfn</code>. 10 </p><p> 11 12 If <code class="function">threadfn</code> may call <code class="function">do_exit</code> itself, the caller must ensure 13 task_struct can't go away. 14 </p><p> 15 16 Returns the result of <code class="function">threadfn</code>, or <code class="constant">-EINTR</code> if <code class="function">wake_up_process</code> 17 was never called. 18</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-kthread-bind.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch01s07.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-kthread-worker-fn.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">kthread_bind</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span class="phrase">kthread_worker_fn</span></td></tr></table></div></body></html> 19