UnlockSegment

2.x

  void UnlockSegment(uSegment)    
  UINT uSegment; /* specifies segment to unlock */

The UnlockSegment function unlocks the specified discardable memory segment. The function decrements (decreases by one) the segment's lock count. The segment is completely unlocked and subject to discarding when the lock count reaches zero.

Parameters

uSegment

Specifies the segment address of the segment to be unlocked. If this parameter is –1, the UnlockSegment function unlocks the current data segment.

Return Value

The return value is the lock count for the segment, if the function is successful. This function returns its result in the CX register. When the CX register contains zero, the segment is completely unlocked.

The value returned when the function is called in C should be ignored, because the return value can be checked only in assembly language.

Comments

An application should not rely on the return value to determine the number of times it must subsequently call UnlockSegment for the segment.

Other functions also can affect the lock count of a memory object. For a list of these functions, see the description of the GlobalFlags function.

Each time an application calls LockSegment for a segment, it must eventually call UnlockSegment for the segment.

See Also

GlobalFlags, LockSegment, UnlockData