1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>flush_scheduled_work</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="ch01s06.html" title="Workqueues and Kevents"><link rel="prev" href="API-cancel-delayed-work-sync.html" title="cancel_delayed_work_sync"><link rel="next" href="API-execute-in-process-context.html" title="execute_in_process_context"></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">flush_scheduled_work</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-cancel-delayed-work-sync.html">Prev</a> </td><th width="60%" align="center">Workqueues and Kevents</th><td width="20%" align="right"> <a accesskey="n" href="API-execute-in-process-context.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-flush-scheduled-work"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>flush_scheduled_work — 2 ensure that any scheduled work has run to completion. 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">void <b class="fsfunc">flush_scheduled_work </b>(</code></td><td> <var class="pdparam">void</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idp1107772564"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>void</code></em></span></dt><dd><p> 4 no arguments 5 </p></dd></dl></div></div><div class="refsect1"><a name="idp1107774172"></a><h2>Description</h2><p> 6 </p><p> 7 8 Forces execution of the kernel-global workqueue and blocks until its 9 completion. 10 </p><p> 11 12 Think twice before calling this function! It's very easy to get into 13 trouble if you don't take great care. Either of the following situations 14</p></div><div class="refsect1"><a name="idp1107775284"></a><h2>will lead to deadlock</h2><p> 15 </p><p> 16 17 One of the work items currently on the workqueue needs to acquire 18 a lock held by your code or its caller. 19 </p><p> 20 21 Your code is running in the context of a work routine. 22 </p><p> 23 24 They will be detected by lockdep when they occur, but the first might not 25 occur very often. It depends on what work items are on the workqueue and 26 what locks they need, which you have no control over. 27 </p><p> 28 29 In most situations flushing the entire workqueue is overkill; you merely 30 need to know that a particular work item isn't queued and isn't running. 31 In such cases you should use <code class="function">cancel_delayed_work_sync</code> or 32 <code class="function">cancel_work_sync</code> instead. 33</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-cancel-delayed-work-sync.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch01s06.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-execute-in-process-context.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">cancel_delayed_work_sync</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">execute_in_process_context</span></td></tr></table></div></body></html> 34