Sophie

Sophie

distrib > Mandriva > 2009.1 > x86_64 > media > main-testing > by-pkgid > 187676b5433787923dfa2cdd6900c6cd > files > 129

lib64pulseaudio-devel-0.9.15-2.0.7mdv2009.1.x86_64.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>PulseAudio: Main Loop</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.8 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
      <li class="current"><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="main.html">main</a>&nbsp;&raquo&nbsp;<a class="el" href="async.html">Asynchronous API</a>
  </div>
</div>
<div class="contents">
<h1><a class="anchor" name="mainloop">Main Loop </a></h1><h2><a class="anchor" name="overv_sec">
Overview</a></h2>
The built-in main loop implementation is based on the poll() system call. It supports the functions defined in the main loop abstraction and very little else.<p>
The main loop is created using <a class="el" href="mainloop_8h.html#d6c767781474275159c0a5f3f7e2ecb5" title="Allocate a new main loop object.">pa_mainloop_new()</a> and destroyed using <a class="el" href="mainloop_8h.html#6c6ea37ce2815640f7f1a133f845f8e7" title="Free a main loop object.">pa_mainloop_free()</a>. To get access to the main loop abstraction, <a class="el" href="mainloop_8h.html#9e5b510dabb4eb1a01645c4db65b9ddb" title="Return the abstract main loop abstraction layer vtable for this main loop.">pa_mainloop_get_api()</a> is used.<h2><a class="anchor" name="iter_sec">
Iteration</a></h2>
The main loop is designed around the concept of iterations. Each iteration consists of three steps that repeat during the application's entire lifetime:<p>
<ol type=1>
<li>Prepare - Build a list of file descriptors that need to be monitored and calculate the next timeout.</li><li>Poll - Execute the actual poll() system call.</li><li>Dispatch - Dispatch any events that have fired.</li></ol>
<p>
When using the main loop, the application can either execute each iteration, one at a time, using <a class="el" href="mainloop_8h.html#491422aebe5487800d8be0bf4153cb81" title="Run a single iteration of the main loop.">pa_mainloop_iterate()</a>, or let the library iterate automatically using <a class="el" href="mainloop_8h.html#fbcd8f4eba09cdfd5323ac9db3718ae8" title="Run unlimited iterations of the main loop object until the main loop&#39;s quit()...">pa_mainloop_run()</a>.<h2><a class="anchor" name="thread_sec">
Threads</a></h2>
The main loop functions are designed to be thread safe, but the objects are not. What this means is that multiple main loops can be used, but only one object per thread. </div>
<hr size="1"><address style="text-align: right;"><small>Generated on Wed Sep 2 04:18:20 2009 for PulseAudio by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
</body>
</html>