Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
DosLockSeg (1.2)
◄Function Group► ◄Overview► ◄Up► ◄Next► ◄Previous►
────────────────────────────────────────────────────────────────────────────
#define INCL_DOSMEMMGR
USHORT DosLockSeg(sel)
SEL sel; /* selector of segment to lock */
The DosLockSeg function locks a discardable segment in memory. A locked
segment cannot be discarded until it is unlocked by using the DosUnlockSeg
function.
If a segment has been discarded, the DosLockSeg function returns an error
value that specifies that the segment no longer exists. When this occurs,
the DosReallocSeg function can be called to allocate a new copy of the
segment. The program must recreate any discarded data.
Parameter Description
────────────────────────────────────────────────────────────────────────────
sel Specifies the selector of the segment to lock.
Return Value
The return value is zero if the function is successful. Otherwise, it is an
error value.
Comments
The DosLockSeg function applies only to segments that have been allocated by
using the DosAllocSeg function with the fAlloc parameter set to
SEG_DISCARDABLE.
MS OS/2 can move and swap a locked segment as needed.
The DosLockSeg and DosUnlockSeg functions can be nested. For example, if
DosLockSeg is called five times to lock a segment, DosUnlockSeg must be
called five times to unlock the segment. A segment becomes permanently
locked if it is locked 255 times without being unlocked.
See Also
DosAllocSeg, DosReallocSeg, DosUnlockSeg
♦