haiku-website/static/legacy-docs/bebook/BTimedEventQueue_Overview.html

31 lines
7.3 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>The Be Book - System Overview - The Media Kit</title><link rel="stylesheet" href="be_book.css" type="text/css" media="all" /><link rel="shortcut icon" type="image/vnd.microsoft.icon" href="./images/favicon.ico" /><!--[if IE]>
<link rel="stylesheet" type="text/css" href="be_book_ie.css" />
<![endif]--><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content="Access, BeOS, BeBook, API" /><link rel="start" href="index.html" title="The Be Book" /><link rel="up" href="TheMediaKit_Overview.html" title="The Media Kit" /><link rel="prev" href="BTimeCode_Overview.html" title="BTimeCode" /><link rel="next" href="BTimeSource_Overview.html" title="BTimeSource" /></head><body><div id="header"><div id="headerT"><div id="headerTL"><a accesskey="p" href="BTimeCode_Overview.html" title="BTimeCode"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a accesskey="u" href="TheMediaKit_Overview.html" title="The Media Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a accesskey="n" href="BTimeSource_Overview.html" title="BTimeSource"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="headerTR"><div id="navigpeople"><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div><div class="navigboxed" id="navigindex"><a accesskey="i" href="ClassIndex.html" title="Index">I</a></div><div class="navigboxed" id="naviglang" title="English">en</div></div><div id="headerTC">The Be Book - System Overview - The Media Kit</div></div><div id="headerB">Prev: <a href="BTimeCode_Overview.html">BTimeCode</a>  Up: <a href="TheMediaKit_Overview.html">The Media Kit</a>  Next: <a href="BTimeSource_Overview.html">BTimeSource</a></div><hr /></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h2 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BTimedEventQueue_Overview"></a>BTimedEventQueue</h2></div></div></div><a id="id591786" class="indexterm"></a><p>The
<a class="link" href="BTimedEventQueue.html" title="BTimedEventQueue"><code class="classname">BTimedEventQueue</code></a>
class provides an easy way to queue a sequence of
events within your node. You can use it to queue up start, stop, and seek
requests, and to queue up incoming data buffers in preparation for
handling them. Each queue element is tagged with the time at which the
event should be processed, and functions are provided for locating the
next event that should be handled.</p><div class="admonition note"><div class="title">Note</div><div class="graphic"><img class="icon" alt="Note" width="32" src="./images/admonitions/Info_32.png" /><div class="text"><p>Although you shouldn't need to subclass
<a class="link" href="BTimedEventQueue.html" title="BTimedEventQueue"><code class="classname">BTimedEventQueue</code></a>,
there's no reason you can't do it.</p></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="id591837"></a>Cleaning Up After Nodes</h3></div></div></div><p>Each event has a cleanup flag associated with it that indicates what sort
of special action needs to be performed when the event is removed from
the queue. If this value is <code class="constant">B_NO_CLEANUP</code>, nothing is done. If it's
<code class="constant">B_RECYCLE</code>, and the event is a
<code class="constant">B_HANDLE_BUFFER</code> event,
<a class="link" href="BTimedEventQueue.html" title="BTimedEventQueue"><code class="classname">BTimedEventQueue</code></a>
will automatically recycle the buffer associated with the event.</p><p>If the cleanup flag is <code class="constant">B_DELETE</code> or
is <code class="constant">B_USER_CLEANUP</code> or greater, the
cleanup hook function will be called. You can implement and establish a
cleanup hook function to handle deleting event data yourself. The hook
function is of type <span class="type">cleanup_hook</span>:</p><pre class="programlisting example">typedef <span class="type">void</span> (*<span class="type">cleanup_hook</span>)(<span class="type">void *</span><code class="parameter">context</code>, <span class="type">bigtime_t</span> <code class="parameter">time</code>, <span class="type">int32</span> <code class="parameter">what</code>,
<span class="type">void *</span><code class="parameter">pointer</code>, <span class="type">uint32</span> <code class="parameter">pointerCleanup</code>, <span class="type">int64</span> <code class="parameter">data</code>);</pre><p>You specify the cleanup hook function by calling
<a class="link" href="BTimedEventQueue.html#BTimedEventQueue_SetCleanupHook" title="SetCleanupHook()"><code class="methodname">SetCleanupHook()</code></a>,
like this:</p><pre class="programlisting example"><code class="methodname">SetCleanupHook</code>(<code class="function">MyCleanupFunction</code>, <code class="varname">contextPtr</code>);</pre><p>The <code class="varname">contextPtr</code> is a pointer that your cleanup hook function uses, and can
contain whatever data you require.</p></div></div><div id="footer"><hr /><div id="footerT">Prev: <a href="BTimeCode_Overview.html">BTimeCode</a>  Up: <a href="TheMediaKit_Overview.html">The Media Kit</a>  Next: <a href="BTimeSource_Overview.html">BTimeSource</a> </div><div id="footerB"><div id="footerBL"><a href="BTimeCode_Overview.html" title="BTimeCode"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a href="TheMediaKit_Overview.html" title="The Media Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a href="BTimeSource_Overview.html" title="BTimeSource"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="footerBR"><div><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div></div><div id="footerBC"><a href="http://www.access-company.com/home.html" title="ACCESS Co."><img alt="Access Company" src="./images/access_logo.png" /></a></div></div></div><div id="licenseFooter"><div id="licenseFooterBL"><a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/" title="Creative Commons License"><img alt="Creative Commons License" style="border-width:0" src="https://licensebuttons.net/l/by-nc-nd/3.0/88x31.png" /></a></div><div id="licenseFooterBR"><a href="./LegalNotice.html">Legal Notice</a></div><div id="licenseFooterBC"><span id="licenseText">This work is licensed under a
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative
Commons Attribution-Non commercial-No Derivative Works 3.0 License</a>.</span></div></div></body></html>