
CHAPTER 13 SERVICE CALLS
User’s Manual U14833EJ2V0UM
255
Get Memory Block from Variable-Size Memory Pool with Timeout
tget_mpl
[Overview]
Acquires a memory block (with timeout)
[C format]
#include <kernel.h>
ER tget_mpl(ID mplid, UINT blksz, VP *p_blk, TMO tmout);
[Parameters]
I/O
Parameter
Description
I
ID
mplid
ID number of variable-length memory pool from which memory block is to
be acquired
I
UINT
blksz
Requested block size [bytes]
O
VP *
p_blk
Address to store address of memory block
I
TMO
tmout
Timeout time [milliseconds]
[Explanation]
A memory block of the size specified by blksz is acquired from the variable-length memory pool specified by mplid,
and the first address of the memory block is stored in the address specified by p_blk.
The requested size blksz must be a value that is an integral multiple of 8. If any other value is specified, a size that
is the lowest integral multiple of 8 greater than blksz is automatically assumed. The actual size of the memory block
extracted from the memory pool is greater than the specified size because a header area that manages the memory
block is included.
If no vacant memory block exists in the memory pool when tget_mpl is issued, the task waits for the memory block
and is registered to the waiting task queue of the memory pool until it can get the memory block or the time specified
by tmout elapses. The task is registered to the queue in the order (on an FIFO basis or according to priority) specified
when the memory pool was created. If a memory block is released by rel_mpl, it is checked whether a waiting task
can get the memory block in the order in which the tasks are placed in the queue. If two or more tasks are waiting,
therefore, they may be blocked by a task requesting a larger size. Consequently, the tasks may be kept waiting even
though the requested size is smaller than the vacant area of the memory pool.
If TMO_POL = 0 is specified as tmout, 0 is specified as the timeout time and tget_mpl performs the same operation
as pget_mpl. If TMO_FEVR =
1 is specified as tmout, the timeout time is specified to be infinite and the service call
performs the same operation as get_mpl.