[Toc][Index]

DosLockSeg


Bindings:  C, MASM 

This call locks a discardable segment in memory. 
 DosLockSeg    (Selector) 
 
 Selector (SEL) - input 
    Selector of the segment to be locked. 
 rc (USHORT) - return 
    Return code descriptions are: 
    0         NO_ERROR 
    5         ERROR_ACCESS_DENIED 
    157       ERROR_DISCARDED 
 
 Remarks 
 Discardable segments are useful for holding objects that are accessed for 
 short periods of time and that can be regenerated quickly if discarded. 
  Examples are cache buffers for a data base package, saved bitmap images 
 for obscured windows or precomputed display images for a word processing 
 application. 
 Discardable memory is allocated by a call to DosAllocSeg or  DosAllocHuge 
 with AllocFlags bit 2 set.  Upon allocation, the memory is automatically 
 locked for access by the allocating process and cannot be discarded. 
 After the segment is unlocked by a DosUnlockSeg request, the memory can 
 be discarded by the memory manager to remedy a low memory situation. 
  Once memory is discarded, a DosLockSeg call returns ERROR_DISCARDED. 
  The memory is reallocated by a call to DosReallocSeg or DosReallocHuge. 
  The reallocation request automatically locks the memory. 
 Memory allocated as discardable by a DosAllocSeg or  DosAllocHuge request 
 may also have been designated as shareable. Sharing processes that access 
 the discardable shared memory with DosGetSeg have to lock the memory by 
 calling DosLockSeg. See DosGetSeg for more information. 
 DosLockSeg and DosUnlockSeg calls may be nested.  If  DosLockSeg is 
 called multiple times to lock a segment, the same number of calls must be 
 made to DosUnlockSeg before the segment is unlocked.  However, if a 
 segment is locked 255 times, it becomes permanently locked. Additional 
 calls to DosLockSeg and DosUnlockSeg have no effect on the segment's 
 locked state. 
 This function is used on segments that have been allocated through 
 DosAllocSeg with AllocFlags bit 2 (0100B) set. It may be also used on 
 segments that are non-discardable, in which case it has no effect. 

Created using Inf-PHP v.2 (c) 2003 Yuri Prokushev
Created using Inf-HTML v.0.9b (c) 1995 Peter Childs