1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>kthread_worker_fn</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-stop.html" title="kthread_stop"><link rel="next" href="API-queue-kthread-work.html" title="queue_kthread_work"></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_worker_fn</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-kthread-stop.html">Prev</a> </td><th width="60%" align="center">Internal Functions</th><td width="20%" align="right"> <a accesskey="n" href="API-queue-kthread-work.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-kthread-worker-fn"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>kthread_worker_fn — 2 kthread function to process kthread_worker 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_worker_fn </b>(</code></td><td>void * <var class="pdparam">worker_ptr</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idp1108145092"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>worker_ptr</code></em></span></dt><dd><p> 4 pointer to initialized kthread_worker 5 </p></dd></dl></div></div><div class="refsect1"><a name="idp1108146724"></a><h2>Description</h2><p> 6 This function can be used as <em class="parameter"><code>threadfn</code></em> to <code class="function">kthread_create</code> or 7 <code class="function">kthread_run</code> with <em class="parameter"><code>worker_ptr</code></em> argument pointing to an initialized 8 kthread_worker. The started kthread will process work_list until 9 the it is stopped with <code class="function">kthread_stop</code>. A kthread can also call 10 this function directly after extra initialization. 11 </p><p> 12 13 Different kthreads can be used for the same kthread_worker as long 14 as there's only one kthread attached to it at any given time. A 15 kthread_worker without an attached kthread simply collects queued 16 kthread_works. 17</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-stop.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-queue-kthread-work.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">kthread_stop</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">queue_kthread_work</span></td></tr></table></div></body></html> 18