[comp.sys.mac.programmer] When does UnLoadSeg not Unlock a Segment?

mm3d+@andrew.cmu.edu (Matt McNally) (12/07/89)

I seem to have lost my grip while dealing with the
segment *manager*.  It seems that for two of my six
code segments that when I call UnLoadSeg(@SomeSegProc)
that segment is NOT UnLocked by the resource manager.

Is there anything I'm missing about using UnLoadSeg? I
was under the impression that it simply unlocked the
code segment that contained the linked module (function
or procedure) passed via a pointer.

For the record:
    I'm only unloading segments from within the 'Main'
    segment, so I'm not concerned about RTSing back to
    obilivion.

    I'm using MPW 3.0 Pascal, and the '{$S segName}' compiler
    directives to segment the project.

    The code looks that's confusing me looks something like this -

        DebugStr('Do a HD in Maxbugs before Unloading..');

        UnLoadSeg(@foo);    {Works fine, the sement that
                             contains 'foo' is Unlocked.}
        UnLoadSeg(@bar);    {Remains locked ! Arrrrrrgh.}
        UnLoadSeg(@bip);    {Works fine....}

        DebugStr('Do a HD in Maxbugs after Unloading..');

        Note: The second heap dump shows the segments that contain
              foo and bip are unlocked, but bar's segment remains
              locked.  Hmmmm...

Any comments would be greatly appreciated,


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Matt M. McNally - 'Macintosh II Project' Research Programmer/Dugan
                    Carnegie Mellon, H&SS Dean's Office, Pittsburgh 15213
                    mm3d@andrew.cmu.edu | Baker Hall 369B, (412) 268-6990
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=