[Ns-developers] About real-world application integration
Hajime Tazaki
tazaki at sfc.wide.ad.jp
Tue Mar 17 19:34:07 PDT 2009
At Tue, 17 Mar 2009 16:49:22 +0100,
Mathieu Lacage wrote:
>> I become to think that this modification doesn't solve
>> fundamentals. Should it avoid call DeleteProcee() twice?
>>
>> What do you think?
>
>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?
struct Process *process = *i;
if (process->threads.empty ())
{
+ i = m_processes.erase (i);
DeleteProcess (process);
- i = m_processes.erase (i);
}
hajime
More information about the Ns-developers
mailing list