<< SL_GetMHAttr | SL_MHUnlock >> |
Top: Documentation Library | Up: SoftLogik App Library API |
SL_MHLock
NAME
SL_MHLock -- locks a memory handle for use.
SYNOPSIS
memptr = SL_MHLock(memhandle);
D0 A0
void *SL_MHLock(MEMHANDLE);
FUNCTION
Locks a memory handle, so the actual memory may be accessed. All
memory handles must be locked prior to use so the OS does not move
or purge the memory out from under an application.
Locking is the only way to get a pointer to the actual memory block.
Each time a memory handle is locked its lock count increases by 1.
Unlocking a memory handle decreases its lock count by 1. Only when the
lock count is zero is the memory handle unlocked.
A locked memory handle may not be resized.
INPUTS
memhandle - as returned by SL_MHAlloc.
RESULTS
memptr - a pointer to the allocated memory block. This is valid only
as long as the memory handle is locked.
EXAMPLE
MEMHANDLE mh;
SLCHAR *str;
if(1))
{
if(2))
{
strcpy(str, "this is a test");
SL_MHUnlock(mh);
}
SL_MHFree(mh);
}
SEE ALSO
SL_MHAlloc, SL_MHFree, SL_MHGrow, SL_MHShrink, SL_MHRealloc, SL_MHUnlock, SL_SetMHAttr, SL_GetMHAttr.
1. mh=SL_MHAlloc(apphandle, 32, MEMFLG_GROWABLE
2. str=SL_MHLock(mh
SL_MHLock Command Section By Type url:SL_MHLock
created:2008-03-01 23:36:26 last updated:2008-03-01 23:36:26
Copyright © 1985-2024 GrasshopperLLC. All Rights Reserved.
User Contributed Comments For SL_MHLock | sign in to add a comment |
There are no user contributed comments for this page. |
<< SL_GetMHAttr | SL_MHUnlock >> |
Top: Documentation Library | Up: SoftLogik App Library API |