[Ns-developers] About real-world application integration
Mathieu Lacage
mathieu.lacage at sophia.inria.fr
Wed Mar 18 01:18:04 PDT 2009
On Wed, 2009-03-18 at 11:34 +0900, Hajime Tazaki wrote:
> >How about moving the call to erase just after the assignment to the
> >local variable 'process' and before the call to DeleteProcess ?
> >Something like this:
> >
> >> {
> >> NS_LOG_FUNCTION (this);
> >> GarbageCollectDeadProcessesAndThreads ();
> >>- for (std::vector<struct Process *>::iterator i = m_processes.begin
> >>(); i != m_processes.end (); ++i)
> >>+ for (std::vector<struct Process *>::iterator i = m_processes.begin
> >>(); i != m_processes.end ();)
> >> {
> >> struct Process *process = *i;
> >>+ i = m_processes.erase (i);
> >> DeleteProcess (process);
> >> }
> >>- m_processes.clear ();
>
> Sounds good.
> I think that it can modify in
> GarbageCollectDeadProcessesAndThreads as well?
yes, probably.
>
> struct Process *process = *i;
> if (process->threads.empty ())
> {
> + i = m_processes.erase (i);
> DeleteProcess (process);
> - i = m_processes.erase (i);
> }
More information about the Ns-developers
mailing list