⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 work_queues.html

📁 ADI 公司blackfin系列的用户使用文挡。
💻 HTML
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head>  <title></title>  <link rel="stylesheet" media="screen" type="text/css" href="./style.css" />  <link rel="stylesheet" media="screen" type="text/css" href="./design.css" />  <link rel="stylesheet" media="print" type="text/css" href="./print.css" />  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body><a href=start.html>start</a></br><h4><a name="work_queues" id="work_queues">Work Queues</a></h4><div class="level4"><p> A Work Queue is a method used to allow a non blockable process  like an interrupt service routine to trigger a deferred process that may include  blocking functions.</p><p>There is a default work queue monitored by the kernel event deamon keventd. It is possible to create your own work queues </p><p>The following example shows how to use a (possibly) blocking call like vfree to delete a structure.</p><p>An example of using a work queue </p><pre class="code c">  <span class="co2">#include   &lt;linux/workqueue.h&gt;                           </span>       <span class="kw4">struct</span> work_struct work;                                                                                                  INIT_WORK<span class="br0">&#40;</span>&amp;work, delete_my_item, <span class="br0">&#40;</span><span class="kw4">void</span> *<span class="br0">&#41;</span>item <span class="br0">&#41;</span>       schedule_work<span class="br0">&#40;</span>&amp;work<span class="br0">&#41;</span>;                                                                                                ...                                                                                                                   <span class="kw4">void</span> delete_my_item<span class="br0">&#40;</span> <span class="kw4">void</span> * item<span class="br0">&#41;</span>                 <span class="br0">&#123;</span>                                                              vfree<span class="br0">&#40;</span>item<span class="br0">&#41;</span>;                                            <span class="br0">&#125;</span></pre><p>This is an example of creating a work queue</p><pre class="code c">&nbsp;<span class="kw4">struct</span> workqueue_struct * keventd_wq;&nbsp;<span class="kw4">void</span> init_workqueues<span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span><span class="br0">&#123;</span>        keventd_wq = create_workqueue<span class="br0">&#40;</span><span class="st0">"events"</span><span class="br0">&#41;</span>;        BUG_ON<span class="br0">&#40;</span>!keventd_wq<span class="br0">&#41;</span>;<span class="br0">&#125;</span>&nbsp;</pre><p>The Kernel Functions for the Work Queue system are as follows </p><table class="inline">	<tr>		<td> schedule_work </td><td>queue the work on the keventd work queue</td>	</tr>	<tr>		<td> schedule_delayed_work </td><td> queue the work on the keventd after a delay in jiffies</td>	</tr>	<tr>		<td> schedule_delayed_work_on </td><td> queue the work on a selected cpu</td>	</tr>	<tr>		<td class="leftalign"> flush_scheduled_work  </td><td> wait until all schedule jobs are completed</td>	</tr>	<tr>		<td class="leftalign"> queue_work     </td><td class="leftalign"> queue the task on a work queue  </td>	</tr>	<tr>		<td> queue_delayed_work </td><td> queue the work after a delay in jiffies</td>	</tr>	<tr>		<td> flush_workqueue </td><td> wait until all the queued tasks have completed</td>	</tr>	<tr>		<td> __create_workqueue </td><td> create a new workqueue</td>	</tr>	<tr>		<td> destroy_workqueue </td><td> delete a workqueue</td>	</tr></table><br /></div></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -