dmBuffer(3dm)dmBuffer(3dm)NAME
dmBufferAllocate, dmBufferAllocateSize, dmBufferAttach, dmBufferFree,
dmBufferGetAllocSize - allocate and free a DMbuffer
SYNOPSIS
#include <dmedia/dm_buffer.h>
DMstatus dmBufferAllocate(DMbufferpool pool, DMbuffer *buffer);
DMstatus dmBufferAllocateSize(DMbufferpool pool, int size, DMbuffer *buffer);
DMstatus dmBufferAttach( DMbuffer *buffer);
DMstatus dmBufferFree(DMbuffer buffer);
int dmBufferGetAllocSize(DMbufferpool pool);
DESCRIPTION
dmBufferAllocate reserves a DMbuffer in the specified DMbufferpool. The
buffer handle is returned to the address specified with buffer. The
availability of buffers in the pool is determined with select(2) (See
dmBufferGetPoolFD(3dm) ). If no buffers are available this call
immediately returns with DM_FAILURE. The buffer remains reserved until
its handle is passed to dmBufferFree(3dm).
dmBufferAllocateSize is similar to dmBufferAllocate except that a buffer
size may be specified which is different from the default size set when
the DMbufferpool was created. This call can only be used on
DMbufferpools created with the DM_POOL_VARIABLE parameter set although
dmBufferAllocate can be used on any pool regardless of this parameter
(see dmBufferCreatePool(3dm) ).
dmBufferAllocateSize returns DM_FAILURE if called on a DMbufferpool that
was created without the DM_POOL_VARIABLE parameter set, if no buffers are
available, or if not enough space remains in the pool to satisfy the size
request.
dmBufferAttach attaches a user to a buffer that has already been
allocated using dmBufferAllocate(3dm) A user attached to a buffer must
free the buffer ( dmBufferFree(3dm) ) when it is no longer needed.
dmBufferFree indicates the buffer is no longer being used by the caller
and will eventually be freed. Operations on buffer after this call are
invalid and not defined.
dmBufferGetAllocSize returns the size of the buffer allocated when a
dmBufferAllocate is called on pool.
SEE ALSOdmBufferCreatePool(3dm), dmBufferGetPoolState(3dm), dmICSend(3dm),
dmGetError(3dm), vlDMBufferSend(3dm).
Page 1