diff options
Diffstat (limited to 'build/doc/html/page_thread_loop.html')
-rw-r--r-- | build/doc/html/page_thread_loop.html | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/build/doc/html/page_thread_loop.html b/build/doc/html/page_thread_loop.html new file mode 100644 index 00000000..34b00814 --- /dev/null +++ b/build/doc/html/page_thread_loop.html @@ -0,0 +1,102 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.15"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>PipeWire: Threaded Loop</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="navtree.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="resize.js"></script> +<script type="text/javascript" src="navtreedata.js"></script> +<script type="text/javascript" src="navtree.js"></script> +<script type="text/javascript"> +/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ + $(document).ready(initResizable); +/* @license-end */</script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">PipeWire +  <span id="projectnumber">0.2.9</span> + </div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.15 --> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ +$(function() { + initMenu('',false,false,'search.php','Search'); +}); +/* @license-end */</script> +<div id="main-nav"></div> +</div><!-- top --> +<div id="side-nav" class="ui-resizable side-nav-resizable"> + <div id="nav-tree"> + <div id="nav-tree-contents"> + <div id="nav-sync" class="sync"></div> + </div> + </div> + <div id="splitbar" style="-moz-user-select:none;" + class="ui-resizable-handle"> + </div> +</div> +<script type="text/javascript"> +/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ +$(document).ready(function(){initNavTree('page_thread_loop.html','');}); +/* @license-end */ +</script> +<div id="doc-content"> +<div class="PageDoc"><div class="header"> + <div class="headertitle"> +<div class="title">Threaded Loop </div> </div> +</div><!--header--> +<div class="contents"> +<div class="textblock"><h1><a class="anchor" id="sec_thread_loop_overview"></a> +Overview</h1> +<p>The threaded loop implementation is a special wrapper around the regular <a class="el" href="structpw__loop.html">pw_loop</a> implementation.</p> +<p>The added feature in the threaded loop is that it spawns a new thread that runs the wrapped loop. This allows a synchronous application to use the asynchronous API without risking to stall the PipeWire library.</p> +<h1><a class="anchor" id="sec_thread_loop_create"></a> +Creation</h1> +<p>A <a class="el" href="classpw__thread__loop.html">pw_thread_loop</a> object is created using <a class="el" href="classpw__thread__loop.html#a44be566c483a400be731a840da066cc6" title="Create a new pw_thread_loop.">pw_thread_loop_new()</a>. The <a class="el" href="structpw__loop.html">pw_loop</a> to wrap must be given as an argument along with the name for the thread that will be spawned.</p> +<p>After allocating the object, the thread must be started with <a class="el" href="classpw__thread__loop.html#a1e9d6936347e67f291c60e3d4535c609" title="Start the thread to handle loop.">pw_thread_loop_start()</a></p> +<h1><a class="anchor" id="sec_thread_loop_destruction"></a> +Destruction</h1> +<p>When the PipeWire connection has been terminated, the thread must be stopped and the resources freed. Stopping the thread is done using <a class="el" href="classpw__thread__loop.html#a6b6246af731f756a565ce4422f4d594c" title="Quit the loop and stop its thread.">pw_thread_loop_stop()</a>, which must be called without the lock (see below) held. When that function returns, the thread is stopped and the <a class="el" href="classpw__thread__loop.html">pw_thread_loop</a> object can be freed using <a class="el" href="classpw__thread__loop.html#a9a17c01d9f1eb487fc722ba6e5978fb6" title="Destroy a threaded loop.">pw_thread_loop_destroy()</a>.</p> +<h1><a class="anchor" id="sec_thread_loop_locking"></a> +Locking</h1> +<p>Since the PipeWire API doesn't allow concurrent accesses to objects, a locking scheme must be used to guarantee safe usage. The threaded loop API provides such a scheme through the functions <a class="el" href="classpw__thread__loop.html#abc5210d06140d00bbd57fa7bfff2d2c9" title="Lock the mutex associated with loop.">pw_thread_loop_lock()</a> and <a class="el" href="classpw__thread__loop.html#a6f8d7df649ce90ac6897fa191d2ddae5" title="Unlock the mutex associated with loop.">pw_thread_loop_unlock()</a>.</p> +<p>The lock is recursive, so it's safe to use it multiple times from the same thread. Just make sure you call <a class="el" href="classpw__thread__loop.html#a6f8d7df649ce90ac6897fa191d2ddae5" title="Unlock the mutex associated with loop.">pw_thread_loop_unlock()</a> the same number of times you called <a class="el" href="classpw__thread__loop.html#abc5210d06140d00bbd57fa7bfff2d2c9" title="Lock the mutex associated with loop.">pw_thread_loop_lock()</a>.</p> +<p>The lock needs to be held whenever you call any PipeWire function that uses an object associated with this loop. Make sure you do not hold on to the lock more than necessary though, as the threaded loop stops while the lock is held.</p> +<h1><a class="anchor" id="sec_thread_loop_events"></a> +Events and Callbacks</h1> +<p>All events and callbacks are called with the thread lock held. </p> +</div></div><!-- PageDoc --> +</div><!-- contents --> +</div><!-- doc-content --> +<!-- start footer part --> +<div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> + <ul> + <li class="navelem"><a class="el" href="index.html">index</a></li><li class="navelem"><a class="el" href="page_remote_api.html">Remote API</a></li> + <li class="footer">Generated by + <a href="http://www.doxygen.org/index.html"> + <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.15 </li> + </ul> +</div> +</body> +</html> |