Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper 5.3 . Technical Reference - <b>_xvunwire()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _xvunwire()
 Unlock a wired VM segment
------------------------------------------------------------------------------
 C Prototype

     #include "vm.api"
     void _xvunwire(
                     HANDLE hSegment
                   )

 Arguments

     hSegment is the VM segment handle returned by _xvalloc().

 Returns

     _xvunwire() has no return value.

 Description

     _xvunwire() unlocks a VM segment locked by _xvwire() and invalidates any
     pointers to that segment.  Unwiring a segment allows the VMM system to
     move and swap the segment as needed.

     Note:  If the segment's lock count (_xvlockcount()) is greater than
     one, the lock count is decremented but the segment remains locked.  The
     segment will not be unlocked until its lock count is decremented to
     zero.

     Warning!  After you unlock a VM segment, you should not attempt to
     access it with the far pointer returned by _xvwire() since there is no
     guarantee that the segment at that physical memory address is the
     segment you previously locked.  If you need further access to the
     contents of the segment, lock it again and use the new pointer returned
     by _xvwire().

 Examples

     .  This example allocates a segment with _xvalloc() and locks it
        with _xvwire().  After a string is copied into the segment, it is
        unlocked and freed.

        // CA-Clipper include files
        #include "extend.api"
        #include "vm.api"

        // Microsoft C include files
        #include "string.h"

        // Prototypes
        Boolean VMWireExSetup(char * spSrc);
        void VMWireExExit(void);

        static HANDLE hSegment;
        static char * spString = NULL;


        Boolean VMWireExSetup(char * spSrc)
        {
           Boolean bResult = FALSE;

           if (hSegment = _xvalloc(strlen(spSrc) + 1, 0))
              {
              spString = _xvwire(hSegment);
              if (spString != NULL)
                 {
                 strcpy(spString, spSrc);


                 bResult = TRUE;

                 }
              else
                 _xvfree(hSegment);
              }

           return (bResult);
        }


        void VMWireExExit(void)
        {
            // Clean up if anything was allocated
           if (spString)
              {
              _xvunwire(hSegment);

              spString = NULL;

              _xvfree(hSegment);
              }

           return;

        }

 Files  Library is CLIPPER.LIB, header file is Vm.api.


See Also: _xvalloc() _xvfree() _xvlockcount() _xvunlock() _xvwire()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson