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

128 lines
27 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.

This file contains Unicode characters that might be confused with other characters. 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 - Classes And Methods - 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.html" title="The Media Kit" /><link rel="prev" href="BBufferConsumer.html" title="BBufferConsumer" /><link rel="next" href="BBufferProducer.html" title="BBufferProducer" /></head><body><div id="header"><div id="headerT"><div id="headerTL"><a accesskey="p" href="BBufferConsumer.html" title="BBufferConsumer"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a accesskey="u" href="TheMediaKit.html" title="The Media Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a accesskey="n" href="BBufferProducer.html" title="BBufferProducer"><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 - Classes And Methods - The Media Kit</div></div><div id="headerB">Prev: <a href="BBufferConsumer.html">BBufferConsumer</a>  Up: <a href="TheMediaKit.html">The Media Kit</a>  Next: <a href="BBufferProducer.html">BBufferProducer</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="BBufferGroup"></a>BBufferGroup</h2></div></div></div><a id="id1121986" class="indexterm"></a><div class="classheader"><table border="0"><colgroup><col /><col /></colgroup><tbody><tr><td><table width="100%" border="0"><colgroup><col /><col /></colgroup><tbody><tr><td>Derived From:</td><td></td></tr><tr><td>Mix-in Classes:</td><td></td></tr><tr><td>Declared In:</td><td><code class="filename">media/BufferGroup.h</code></td></tr><tr><td>Library:</td><td><code class="filename">libmedia.so</code></td></tr><tr><td>Allocation:</td><td>Constructor only</td></tr></tbody></table></td><td>
<a class="link overview" href="BBufferGroup_Overview.html" title="BBufferGroup">Class Overview</a>
<div class="toc"><ul><li><span class="section"><a href="BBufferGroup.html#BBufferGroup_ConstructorDestructor">Constructor and Destructor</a></span></li><li><span class="section"><a href="BBufferGroup.html#BBufferGroup_MemberFunctions">Member Functions</a></span></li></ul></div>
</td></tr></tbody></table></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="BBufferGroup_ConstructorDestructor"></a>Constructor and Destructor</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBufferGroup_Constructor"></a>BBufferGroup()</h4></div></div></div><div class="synopsisgroup">
<code class="constructorsynopsis cpp"><span class="methodname">BBufferGroup</span>(<span class="methodparam"><span class="type">size_t </span><span class="parameter">size</span></span>,<br />             <span class="methodparam"><span class="type">int32 </span><span class="parameter">numBuffers</span><span class="initializer"> = 3</span></span>,<br />             <span class="methodparam"><span class="type">uint32 </span><span class="parameter">placement</span><span class="initializer"> = <span class="constant">B_ANY_ADDRESS</span></span></span>,<br />             <span class="methodparam"><span class="type">uint32 </span><span class="parameter">lock</span><span class="initializer"> = <span class="constant">B_FULL_LOCK</span></span></span>);</code>
<code class="constructorsynopsis cpp"><span class="methodname">BBufferGroup</span>();</code>
<code class="constructorsynopsis cpp"><span class="methodname">BBufferGroup</span>(<span class="methodparam"><span class="type">int32 </span><span class="parameter">numBuffers</span></span>,<br />             <span class="methodparam"><span class="modifier">const </span><span class="type">buffer_id * </span><span class="parameter">bufferList</span></span>);</code>
</div><p>The first form of the constructor creates a
<code class="classname">BBufferGroup</code> with some number
of <a class="link" href="BBuffer.html" title="BBuffer"><code class="classname">BBuffer</code></a>s
already allocated by the group. These buffers will all live
within a single Kernel Kit area, allocated by the group. The group tries
to allocate an area with properties specified by the <code class="parameter">placement</code>
and <code class="parameter">lock</code>
arguments, large enough to hold <code class="parameter">numBuffers</code>
buffers of the specified <code class="parameter">size</code>
(there may be some padding added).</p><p>The second form of the constructor creates a <code class="classname">BBufferGroup</code> but doesn't
create any buffers for it. You should add
<a class="link" href="BBuffer.html" title="BBuffer"><code class="classname">BBuffer</code></a>s
to the group before trying to use it.</p><p>The third form of the constructor creates a <code class="classname">BBufferGroup</code> that contains
the specified list of buffers. <code class="parameter">bufferList</code> points to an array of buffer
IDs for the buffers to be controlled by the group, and <code class="parameter">numBuffers</code> is the
number of buffers in the list. This version of the constructor isn't one
you'll use very often.</p><p>Before using any buffers from a new <code class="classname">BBufferGroup</code>,
call <a class="link" href="BBufferGroup.html#BBufferGroup_InitCheck" title="InitCheck()"><code class="methodname">InitCheck()</code></a> to
determine if any errors occurred while creating the group.</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBufferGroup_Destructor"></a>~BBufferGroup()</h4></div></div></div><code class="destructorsynopsis cpp"><span class="methodname">~BBufferGroup</span>();</code><p>Releases all memory used by the <code class="classname">BBufferGroup</code>,
including the
<a class="link" href="BBuffer.html" title="BBuffer"><code class="classname">BBuffer</code></a>s it
controls.</p><p>Keep in mind that
<a class="link" href="BBufferGroup.html#BBufferGroup_AddBuffer" title="AddBuffer()"><code class="methodname">AddBuffer()</code></a>
clones the buffer area. This destructor
releases the clones, but it's your application's job to release the
original area you added.</p><div class="admonition warning"><div class="title">Warning</div><div class="graphic"><img class="icon" alt="Warning" width="32" src="./images/admonitions/Stop_32.png" /><div class="text"><p>Your node needs to delete the buffer group corresponding to any
connection that is disconnected or whenever the node is deleted. Until
your node does so, the other end of the connection will be blocked
waiting for the buffer group to be deleted.</p></div></div></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="BBufferGroup_MemberFunctions"></a>Member Functions</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBufferGroup_AddBuffer"></a>AddBuffer()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">AddBuffer</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">buffer_clone_info&amp; </span><span class="parameter">info</span></span>);</code><p>Given the <span class="type">buffer_clone_info</span>, this function clones the buffer and adds the
clone to the <code class="classname">BBufferGroup</code>. Normally you'll
fill out the <span class="type">buffer_clone_info</span>
structure yourself.</p><p>Since the buffer is cloned, you'll need to delete the original memory
area specified by the <span class="type">buffer_clone_info</span> structure yourself when you're no
longer using it; the <code class="classname">BBufferGroup</code> won't do it for you.</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>You shouldn't pass the result of a
<a class="link" href="BBuffer.html#BBuffer_CloneInfo" title="CloneInfo()"><code class="methodname">BBuffer::CloneInfo()</code></a>
call to this
function, as doing so would create an "alias" buffer for the same memory
area. This is probably not the effect you want.</p></div></div></div><table class="variablelist returncodes"><thead><tr><th>Return Code</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_OK</code>.</span></p></td><td><p>No error adding the buffer to the group.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_NO_MEMORY</code>.</span></p></td><td><p>Couldn't clone the buffer into the <code class="classname">BBufferGroup</code>'s
address space.</p></td></tr></tbody></table></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBufferGroup_AddBuffersTo"></a>AddBuffersTo()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">AddBuffersTo</span>(<span class="methodparam"><span class="type"><span class="classname">BMessage</span>* </span><span class="parameter">message</span></span>,<br />                      <span class="methodparam"><span class="modifier">const </span><span class="type">char* </span><span class="parameter">name</span></span>,<br />                      <span class="methodparam"><span class="type">bool </span><span class="parameter">needLock</span><span class="initializer"> = <span class="constant">true</span></span></span>);</code><p>Adds the group's buffers to the specified
<code class="parameter">message</code>, storing them in an array with the
specified <code class="parameter">name</code>. If
<code class="parameter">needLock</code> is <code class="constant">true</code>, the
<code class="classname">BBufferGroup</code> is locked before performing the
operation, then unlocked when finished; otherwise, you guarantee that the
buffers won't go anywhere during the
<code class="methodname">AddBuffersTo()</code> call.</p><p>The buffers are added by ID number, and are therefore in <span class="type">int32</span> format.</p><table class="variablelist returncodes"><thead><tr><th>Return Code</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_OK</code>.</span></p></td><td><p>No error adding the buffers to the message.</p></td></tr></tbody></table><p>Errors from
<a class="link" href="BMessage.html#BMessage_AddInt32"><code class="methodname">AddInt32()</code></a>.</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBufferGroup_CountBuffers"></a>CountBuffers()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">CountBuffers</span>(<span class="methodparam"><span class="type">int32* </span><span class="parameter">outBufferCount</span></span>);</code><p>Returns, in <code class="parameter">outBufferCount</code>, the
number of buffers in the group.</p><table class="variablelist returncodes"><thead><tr><th>Return Code</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_OK</code>.</span></p></td><td><p>The number of buffers was returned successfully.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_BAD_VALUE</code>.</span></p></td><td><p>Invalid <code class="parameter">outBufferCount</code> pointer</p></td></tr></tbody></table></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBufferGroup_GetBufferList"></a>GetBufferList()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">GetBufferList</span>(<span class="methodparam"><span class="type">int32 </span><span class="parameter">listCount</span></span>,<br />                       <span class="methodparam"><span class="type"><span class="classname">BBuffer</span>** </span><span class="parameter">outBuffers</span></span>);</code><p>Returns a list of all the buffers in the group. When calling
<code class="methodname">GetBufferList()</code>, pass in
<code class="parameter">outBuffers</code> a pointer to an array of
<a class="link" href="BBuffer.html" title="BBuffer"><code class="classname">BBuffer</code></a>
pointers that you want to be filled with pointers to the group's buffers,
and specify the number of elements in the array in <code class="parameter">listCount</code>.</p><table class="variablelist returncodes"><thead><tr><th>Return Code</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_OK</code>.</span></p></td><td><p>No errors.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_BAD_VALUE</code>.</span></p></td><td><p><code class="parameter">listCount</code> is less than 1, or
<code class="parameter">outBuffers</code> is <code class="constant">NULL</code></p></td></tr></tbody></table></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBufferGroup_InitCheck"></a>InitCheck()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">InitCheck</span>();</code><p>Returns the error code resulting from the construction of the
<code class="classname">BBufferGroup</code>.</p><table class="variablelist returncodes"><thead><tr><th>Return Code</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_OK</code>.</span></p></td><td><p>The new group was created successfully.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_ERROR</code>.</span></p></td><td><p>Couldn't allocate the buffers for the group.</p></td></tr><tr><td><p><span class="term">Area errors.</span></p></td><td><p>See <a class="xref" href="TheKernelKit_Areas_Overview.html" title="Areas">Areas</a> in The Kernel Kit.</p></td></tr></tbody></table></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBufferGroup_ReclaimAllBuffers"></a>ReclaimAllBuffers()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">ReclaimAllBuffers</span>();</code><p>If you pass a buffer group to some other
<a class="link" href="BBufferProducer.html" title="BBufferProducer"><code class="classname">BBufferProducer</code></a>
but pass <code class="constant">true</code> for <code class="parameter">willReclaim</code>
in the
<a class="link" href="BBufferConsumer.html#BBufferConsumer_SetOutputBuffersFor" title="SetOutputBuffersFor()"><code class="methodname">BBufferConsumer::SetOutputBuffersFor()</code></a>
call, you can later reclaim the buffers into the
<code class="classname">BBufferGroup</code> by calling
<code class="methodname">ReclaimAllBuffers()</code>.</p><p><code class="methodname">ReclaimAllBuffers()</code> will return
<code class="constant">B_OK</code> when all buffers are accounted for,
or return an error if buffers can't be reclaimed.</p><p>If you have buffers that reference some object that might go away (such
as a <a class="link" href="BBitmap.html" title="BBitmap"><code class="classname">BBitmap</code></a>),
you should call <code class="methodname">ReclaimAllBuffers()</code> on the group and
delete the <code class="classname">BBufferGroup</code> before that object goes away.</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>Before reclaiming your buffers, be sure to call
<span class="code"><code class="classname">BBufferConsumer</code>::<code class="methodname">SetOutputBuffersFor</code>(<code class="varname">output</code>, <code class="constant">NULL</code>)</span>
to let the Media Kit know
your producer no longer has permission to use them. If you forget this
step, the producer will hang onto the buffers until it's deleted, and
your <code class="methodname">ReclaimAllBuffers()</code> call will hang, possibly forever.</p></div></div></div><table class="variablelist returncodes"><thead><tr><th>Return Code</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_OK</code>.</span></p></td><td><p>All buffers reclaimed successfully.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_MEDIA_CANNOT_RECLAIM_BUFFERS</code>.</span></p></td><td><p>Some buffers couldn't be reclaimed.</p></td></tr></tbody></table></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBufferGroup_RequestBuffer"></a>RequestBuffer()</h4></div></div></div><div class="synopsisgroup">
<code class="methodsynopsis cpp"><span class="type"><span class="classname">BBuffer</span>* </span><span class="methodname">RequestBuffer</span>(<span class="methodparam"><span class="type">size_t </span><span class="parameter">size</span></span>,<br />                       <span class="methodparam"><span class="type">bigtime_t </span><span class="parameter">timeout</span><span class="initializer"> = <span class="constant">B_INFINITE_TIMEOUT</span></span></span>);</code>
<code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">RequestBuffer</span>(<span class="methodparam"><span class="type"><span class="classname">BBuffer</span>* </span><span class="parameter">outBuffer</span></span>,<br />                       <span class="methodparam"><span class="type">bigtime_t </span><span class="parameter">timeout</span><span class="initializer"> = <span class="constant">B_INFINITE_TIMEOUT</span></span></span>);</code>
</div><p>Returns a pointer to a
<a class="link" href="BBuffer.html" title="BBuffer"><code class="classname">BBuffer</code></a>
of at least the specified size that your
<a class="link" href="BBufferProducer.html" title="BBufferProducer"><code class="classname">BBufferProducer</code></a>
subclass can put data into, then pass on to a
<a class="link" href="TheMediaKit_DefinedTypes.html#media_destination" title="media_destination"><span class="type">media_destination</span></a>.
If there isn't a suitable buffer available, the call
will block until either a buffer becomes available (in which case the
buffer is returned) or the specified <code class="parameter">timeout</code> is reached.</p><p>If you pass a <code class="parameter">timeout</code> value that's less
than zero, <code class="methodname">RequestBuffer()</code> will
return <code class="constant">NULL</code> immediately if there's no buffer available, otherwise it will
return a pointer to a buffer you can use.</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>In BeOS Release 4.5, the timeout is ignored (unless you specify a
negative value); <code class="constant">B_INFINITE_TIMEOUT</code> is always used, regardless of the
value you specify.</p></div></div></div><p><code class="methodname">RequestBuffer()</code> doesn't use the buffer flags; instead, you can look at
the buffers within a <code class="classname">BBufferGroup</code> to find a specific buffer to request
yourself, based on the value returned by
<a class="link" href="BBuffer.html#BBuffer_Flags" title="Flags()"><code class="methodname">BBuffer::Flags()</code></a>
or
<a class="link" href="BBuffer.html#BBuffer_SizeUsed" title="SizeUsed(), SetSizeUsed()"><code class="methodname">BBuffer::SizeUsed()</code></a>,
for example. Use the second form of <code class="methodname">RequestBuffer()</code> to
obtain a specific buffer.</p><p>The first version of <code class="methodname">RequestBuffer()</code>
returns <code class="constant">NULL</code> if no buffer can be
obtained, and sets <code class="varname">errno</code>
to the appropriate error code. The second
version returns an appropriate error code.</p><div class="admonition warning"><div class="title">Warning</div><div class="graphic"><img class="icon" alt="Warning" width="32" src="./images/admonitions/Stop_32.png" /><div class="text"><p>Don't call <code class="methodname">RequestBuffer()</code> while an outstanding
<a class="link" href="BBufferGroup.html#BBufferGroup_ReclaimAllBuffers" title="ReclaimAllBuffers()"><code class="methodname">ReclaimAllBuffers()</code></a>
request is pending. To make sure that doesn't happen, a buffer producer
should be designed to not know about the old group anymore once
<a class="link" href="BBufferProducer.html#BBufferProducer_SetBufferGroup" title="SetBufferGroup()"><code class="methodname">SetBufferGroup()</code></a>
is called to change its buffer group.</p></div></div></div><table class="variablelist returncodes"><thead><tr><th>Return Code</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_OK</code>.</span></p></td><td><p>No errors.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_MEDIA_BUFFERS_NOT_RECLAIMED</code>.</span></p></td><td><p>Buffers are in the process of being reclaimed.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_ERROR</code>.</span></p></td><td><p>A miscellaneous error occurred.</p></td></tr></tbody></table></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBufferGroup_RequestError"></a>RequestError()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">RequestError</span>();</code><p>Returns the last
<a class="link" href="BBufferGroup.html#BBufferGroup_RequestBuffer" title="RequestBuffer()"><code class="methodname">RequestBuffer()</code></a>
error. This is useful if
<a class="link" href="BBufferGroup.html#BBufferGroup_RequestBuffer" title="RequestBuffer()"><code class="methodname">RequestBuffer()</code></a>
returns <code class="constant">NULL</code>.</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBufferGroup_WaitForBuffers"></a>WaitForBuffers()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">WaitForBuffers</span>();</code><p>Waits until the currently pending buffer reclamation is finished, then
returns. If there isn't a buffer reclamation in progress, returns
immediately.</p><table class="variablelist returncodes"><thead><tr><th>Return Code</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_OK</code>.</span></p></td><td><p>No errors.</p></td></tr><tr><td><p><span class="term">Semaphore errors.</span></p></td><td><p>Unable to acquire the semaphore used to detect that
buffer reclamation is done.</p></td></tr></tbody></table></div></div></div><div id="footer"><hr /><div id="footerT">Prev: <a href="BBufferConsumer.html">BBufferConsumer</a>  Up: <a href="TheMediaKit.html">The Media Kit</a>  Next: <a href="BBufferProducer.html">BBufferProducer</a> </div><div id="footerB"><div id="footerBL"><a href="BBufferConsumer.html" title="BBufferConsumer"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a href="TheMediaKit.html" title="The Media Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a href="BBufferProducer.html" title="BBufferProducer"><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>