AMX 86 Frozen Dessert Maker User Manual


 
120
K
A
DAK
AMX Buffer Manager
9.2 Buffer Pool Use
The Buffer Manager supports any number of pools of buffers. The maximum number of
buffer pools in a system is defined in your System Configuration Module (see Chapter
14.5). The defined maximum sets an upper limit on the number of actual buffer pools
that can be created in your application.
A pool of buffers consists of any number of buffers of a uniform size measured in bytes.
Any even buffer size greater than or equal to eight bytes is allowed, up to the limits of a
64K memory segment. All of the buffers in a pool must reside in the same memory
segment.
Create Buffer Pool
A buffer pool must be created by an application before it can be used. Restart
Procedures, tasks, ISPs and Timer Procedures can create buffer pools. It is recommended
that only Restart Procedures and tasks be used to create buffer pools.
Buffer Manager procedure ajbcre is used to create a buffer pool. The Buffer Manager
allocates a buffer pool and returns a buffer pool id to the caller. The pool id is a handle
which uniquely identifies the buffer pool. It is the responsibility of the application to
keep track of the pool id for future reference to the buffer pool.
When a buffer pool is created, you must specify the following parameters: the number of
buffers in the pool, the size of each buffer and a pointer to RAM storage for all of the
buffers in the pool.
When a buffer pool is created, you can provide a unique 4-character tag to identify the
buffer pool. The tag can be used subsequently in a call to ajbtag to find the buffer pool
id allocated by the Buffer Manager to the particular buffer pool.
When the Buffer Manager creates a buffer pool, it subdivides the allocated RAM storage
into the required number of buffers.
All buffers in the pool are linked together on a free list. This free list is internal to the
Buffer Manager, hidden from view. Associated with (but not part of) each buffer is a use
count, also internal to the Buffer Manager. The use count is set to zero for each buffer to
show that it is not in use.