swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ReaperQueue


From: Ken Cline
Subject: Re: ReaperQueue
Date: Mon, 19 Jul 1999 22:40:31 -0400 (EDT)

On Mon, 19 Jul 1999, Jayshree Sarma wrote:

> On 19 Jul 1999, Marcus G. Daniels wrote:
> 
> >  - Instead of putting the drop in the loop, use deleteAll instead of 
> >    removeAll.  The way you have it coded, there will be dead
> >    pointers in the reaperQueue by the time you get to removeAll.
> >  - Remember to drop the index when you're done with it
> >  - Use == for equality  tests; = is for assignment.
> > 
> 
> The documentation for deleteAll says that members are
> dropped as well.  So I do not need the line
>     [deadBug drop];
> within the while loop, correct?
> 
> I can just have 
>      [reaperQueue deleteAll];
> after the while loop.
> Do I need the following also?
>     [index drop];
> 

Yes, on all counts.  I would probably drop the index first
and then call `deleteAll', but it shouldn't matter.

In case you are curious, the `deleteAll' method simply creates
an index and loops thru all the members removing each from
the collection and then dropping it (as you probably guessed).

Here's the code from Collections.m:
   - (void) deleteAll {
     id index, member;

     index = [(id) self begin: scratchZone];
     while ((member = [index next])) {
         [index remove];
         [member drop];
     }
     [index drop];
   }


_________________________________________________________
Ken Cline                             address@hidden
SAIC                                 VOICE (410) 571-0413
Annapolis, MD                          FAX (301) 261-8427




                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]